开发者

HTTPModule Only Getting Called Once Per Page

开发者 https://www.devze.com 2023-01-12 03:23 出处:网络
I am trying to implement a custom HTTPModule for ASP.开发者_开发百科NET.I have a very simple html page with an image in it and an HTTPModule that hooks into the BeginRequest event.When I debug with Vi

I am trying to implement a custom HTTPModule for ASP.开发者_开发百科NET. I have a very simple html page with an image in it and an HTTPModule that hooks into the BeginRequest event. When I debug with Visual Studio's dev web server, my module is called twice: one for the initial page request, then once for the image request. This is what I expected. However, when I deploy my application to IIS, the module is only being called once for the page request. I don't understand why. Any ideas? Thanks.


I'm guessing that you are using IIS6 or IIS7 with Classic Managed Pipeline Mode. In that case, your ASP.NET application only receives requests that are mapped to isapi.dll. Typically, these include requests with the following extensions: aspx, ashx, asmx, ... Take a look here for some more info.

Requests for other extensions are handled directly by IIS so they never arrive at your HTTP module (which runs as a part of the ISAPI extension).

In IIS7 and later Microsoft has integrated the pipeline into IIS. This means that all requests pass along the entire ASP.NET pipeline.

Another possibility is that your image is cached somewhere, as suggested by Jon.


First thing to check: is the server actually being contacted at all for the image? Is it in the client cache?

Second thing to check: is it being cached server-side perhaps?

Try loading the URL of the image itself directly in your browser... and maybe add something like ?foo=bar at the end to perform some primitive cache-busting.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号