0

我的 Global.asax 中有以下代码:

void Application_EndRequest(object sender, EventArgs e)
{
    HttpApplication application = sender as HttpApplication;
    HttpContext context = application.Context;
    string path = context.Request.Path;
    string contentType = context.Response.ContentType;

    System.Diagnostics.Debug.WriteLine("-----------------------------------");
    System.Diagnostics.Debug.WriteLine("Path: " + path);
    System.Diagnostics.Debug.WriteLine("ContentType:" + contentType);    
}

我在站点的根目录 (~/Help) 有一个帮助文件夹,其中包含静态 .htm 文件。我注意到并非所有这些文件都通过 EndRequest 运行。有时我会看到正在记录的页面中的资产(例如 .js 文件),但看不到 htm 文件本身。有时他们确实会被记录下来。

为什么不是所有这些文件都通过 EndRequest 运行,我如何确保它们运行?

4

1 回答 1

0

最后我的配置是这样的:

  • AppPool 管道:集成
  • RouteExistingFiles:假(默认)
  • runAllManagedModulesForAllRequests:真

这就是我写这个问题时的样子。我做的不同的事情是进入我的 web.config 并在下面手动添加一个处理程序<httpHandlers>

<add verb="GET,HEAD,POST,DEBUG" path="*.htm" type="System.Web.UI.PageHandlerFactory" />

让我失望的一件事是,一旦文件关闭,浏览器就会缓存它而不是重新请求它(直到我清除缓存)。

于 2014-06-17T19:59:22.963 回答