Quick Search for temporary files generated by ASP. NET

Source: Internet
Author: User

We know that some temporary files are required for processing ASP. NET page requests.ProgramLogic is of great help. Here are two methods:

First, add

Protected   Void Page_load ( Object Sender, eventargs E)
{
Response. Write (This. GetType (). Assembly. Location );
}

The output is similar to the following string:

C: \ windows \ Microsoft. NET \ framework \ v2.0.50727 \ temporary ASP. Net files \ website13 \ 63ed8704 \ 93b8f11b \ app_web_rixp4_rs.dll

Remove the last app_web_rixp4_rs.dll character, copy the remaining strings to the "run" window, and open the corresponding folder.

Take the default. aspx page as an example. Find the file default2.aspx. cdcab7d2. compiled in the opened folder.

Open this file and you will see something similar to the following:

<? XML version = "1.0" encoding = "UTF-8" ?>
< Preserve Resulttype = "3" Virtualpath = "/Website13/default. aspx" Hash = "73ae13447" Filehash = "Ffffe207cb3bfc04" Flags = "110000" Assembly = "App_web_rixp4_rs" Type = "ASP. default_aspx" >
< Filedeps >
< Filedep Name = "/Website13/default. aspx"   />
</ Filedeps >
</ Preserve >

In the open file, find Assembly = "app_web_rixp4_rs" and find the class file starting with app_web_rixp4_rs in the file you just opened. These files are the temporary files we need.

 

Second, we write a file that inherits the ihttphandlerfactory interface.

Public   Class Httphandlerfactory: ihttphandlerfactory
{
Public   Virtual Ihttphandler gethandler (httpcontext context, String Requesttype, String URL, String Pathtranslated)
{
// Get the compilation instance (through reflection)
Pagehandlerfactory Factory = (Pagehandlerfactory) activator. createinstance ( Typeof (Pagehandlerfactory ), True );
Ihttphandler Handler = Factory. gethandler (context, requesttype, URL, pathtranslated );

Responseassemblylocation (context, Handler );

// Return
Return Handler;
}

Public   Virtual   Void Releasehandler (ihttphandler handler)
{
}

[Conditional ( " Debug " )]
Private   Void Responseassemblylocation (httpcontext context, ihttphandler handler)
{
Context. response. Write (handler. GetType (). Assembly. Location );
}
}

Configure in Web. config: < Httphandlers >
< Add Verb = "*" Path = "*. Aspx" Validate = "False" Type = "Httphandlerfactory" />
</ Httphandlers >
< Compilation Debug = "True" />

When DEBUG = "true", the responseassemblylocation method in the httphandlerfactory class can be executed. Otherwise, the method is not executed.
Note that the class file httphandlerfactory generated is in the app_code directory of the website. Therefore, the Assembly name is not configured in the type section of the web. config file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.