惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
Cisco Talos Blog
Cisco Talos Blog
C
Check Point Blog
博客园_首页
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Martin Fowler
Martin Fowler
Recorded Future
Recorded Future
S
Security @ Cisco Blogs
L
LINUX DO - 最新话题
博客园 - 司徒正美
P
Privacy International News Feed
G
Google Developers Blog
I
Intezer
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
C
Cybersecurity and Infrastructure Security Agency CISA
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Scott Helme
Scott Helme
K
Kaspersky official blog
I
InfoQ
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
Webroot Blog
Webroot Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
大猫的无限游戏
大猫的无限游戏
D
Docker
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
量子位
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
SecWiki News
SecWiki News
S
Security Affairs
Latest news
Latest news
人人都是产品经理
人人都是产品经理
C
CERT Recently Published Vulnerability Notes
S
Security Archives - TechRepublic
V
Visual Studio Blog
T
Troy Hunt's Blog
S
Secure Thoughts
F
Fortinet All Blogs
V
V2EX
The Register - Security
The Register - Security
J
Java Code Geeks
MongoDB | Blog
MongoDB | Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - 王庆

crosstool-ng搭建交叉编译环境注意事项 多重继承及虚继承中对象内存的分布 编写和调试Android下JNI程序流程 eclipse xml文件中按alt+/没有提示信息 Android NDK 工具链的使用方法(Standalone Toolchain) 编译Android VNC Server 使用gdb和gdbserver调试Android C/C++程序 openssl在多平台和多语言之间进行RSA加解密注意事项 LINUX开发使用的3个远程工具 NDK 链接第三方静态库的方法 动态生成程序集和类型 关于线程池的一段代码 理解ParseChildren用法 捕获ASP.NET程序发生的异常 Synchronized vs SyncRoot Exception vs ApplicationException 【转】Hashtable,ListDictionary,HybridDictionary比较 Monitor用法 C#多线程之Thread
快速查找ASP.NET产生的临时文件
王庆 · 2008-07-25 · via 博客园 - 王庆

我们知道,ASP.NET 页面请求的处理过程需要使用一些临时文件,这些文件对我们分析页面程序逻辑,有很大的帮助。下边我就说两种方法:

第一种,在页面的Page_Load方法中加入

protected void Page_Load(object sender, EventArgs e)
{
    Response.Write(
this.GetType().Assembly.Location);
}

会输出类似于下面的字符串:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\website13\63ed8704\93b8f11b\App_Web_rixp4_rs.dll

我们去掉最后的App_Web_rixp4_rs.dll字符,将剩下的字符串复制到“运行”窗口,打开相应的文件夹。

我们以default.aspx页面为例,在打开的文件夹中找到类似于这样的文件default2.aspx.cdcab7d2.compiled。

我们打开这个文件,会看到类似于下面的内容:

<?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>

在打开的文件中,我们找到assembly="App_Web_rixp4_rs",在刚才打开的文件中找以App_Web_rixp4_rs开头的类文件。这些文件就是我们需要的临时文件。

第二种,我们写一个继承IHttpHandlerFactory接口的文件

public class HttpHandlerFactory : IHttpHandlerFactory
{
    
public virtual IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated)
    
{
        
//得到编译实例(通过反射)
        PageHandlerFactory factory = (PageHandlerFactory)Activator.CreateInstance(typeof(PageHandlerFactory), true);
        IHttpHandler handler 
= factory.GetHandler(context, requestType, url, pathTranslated);

        ResponseAssemblyLocation(context, handler);

        
//返回
        return handler;
    }


    
public virtual void ReleaseHandler(IHttpHandler handler)
    
{
    }


    [Conditional(
"DEBUG")]
    
private void ResponseAssemblyLocation(HttpContext context, IHttpHandler handler)
    
{
        context.Response.Write(handler.GetType().Assembly.Location);
    }

}

然后在web.config进行配置一下:

    <httpHandlers>
      
<add verb="*" path="*.aspx" validate="false" type="HttpHandlerFactory"/>
    
</httpHandlers>
        
<compilation debug="true"/>

在debug="true"的情况下,类HttpHandlerFactory中的ResponseAssemblyLocation方法就能执行,反之,不执行。
需要说明的一点是,我生成的类文件HttpHandlerFactory在网站的App_Code目录,故web.config文件中的type节未配置Assembly名称。