stcheng
Wed Oct 12 04:03:29 CDT 2005
Thanks for David's input.
Hi Roger,
As for HttpModule, it'll intercept all the request to the asp.net
application as long as we've registered it for the application in the
config file. Also, the BeginRequest event should fire in each comming
request , so the only fire once on your IIS5 environment seems strange.
Anyway, through my local test (win2k3 server, iis6), i can register a
customer HTTPModule in my asp.net web app and perform some logging task
then let the request go down and I can get jpg file correctly being output
as normal. In fact, by default the ASP.NET has redirect all request which
hasn't been explicitly mapped to a certain httphandler to the
System.Web.StaticFileHandler. The StaticFileHandler just simply output the
static file on the physical dir. You can look for the following config
element in your IIS5 and IIS6's server's machine.config file (in the
<httpHandlers> element) to see whether it resides there.
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler"/>
BTW, for image files, it's recommend that we don't redirect them to ASP.NET
runtime since their may existing lots of http get request for image in a
certain web application which will cause performance issue since each of
such request will consume ASP.NET process's managed threadpool thread.
The raw IIS ISAPI filter is more appropriate for such task.
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "David Wang [Msft]" <someone@online.microsoft.com>
| References: <24F1C8C9-826A-43C6-BB00-C92847543C74@microsoft.com>
| Subject: Re: HTTPModule behavior different between IIS5 and IIS6
| Date: Tue, 11 Oct 2005 21:28:26 -0700
| Lines: 52
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| Message-ID: <#6agreuzFHA.3540@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.inetserver.iis
| NNTP-Posting-Host: tide507.microsoft.com 131.107.0.77
| Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP1
0.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl microsoft.public.inetserver.iis:345040
| X-Tomcat-NG: microsoft.public.inetserver.iis
|
| Questions about ASP.Net behavior should be posted to:
| microsoft.public.dotnet.framework.aspnet or to Forums at www.asp.net
|
| I think the behavior is probably by-design because behaviors you describe
do
| not match how IIS on XP and Win2K3 work. On IIS6, it is possible to
| intercept any request and have ASP.Net/IIS6 continue handling a given
| request. This functionality does not exist on prior IIS versions.
|
| In other words, it is possible on ASP.Net 1.1 and IIS6 to intercept a ASP
| request, do something in ASP.Net, and have IIS6 process the ASP request to
| generate a response. This is not possible to do on any other ASP.Net/IIS
| version. On prior ASP.Net/IIS versions, only static files (such as .jpg)
can
| be processed like this because ASP.Net just opens and sends the file.
|
| --
| //David
| IIS
|
http://blogs.msdn.com/David.Wang
| This posting is provided "AS IS" with no warranties, and confers no
rights.
| //
| "Roger" <RogerRoger@nospam.nospam> wrote in message
| news:24F1C8C9-826A-43C6-BB00-C92847543C74@microsoft.com...
| The task is to create a httpmodule that will be mapped to the extension
| ".jpg", perform a task, and alow the request to continue.
|
| I have a httpmodule that is working exactly as I want it in winXP. When
| deployed to Win2k3, I get a very different result. The module watches the
| BeginRequest event, and calls a method:
|
| public void Init(HttpApplication context)
| {
| context.BeginRequest += new
EventHandler(context_BeginRequest);
| }
|
| This part works fine in both IIS6 and IIS5, when mapped to the .jpg
| extension. Next I have two problems. First, in IIS6, the BeginRequest even
| is
| fired 101 times for every request. In IIS5 it happens only once (I write
to
| the applog so I can see this happening). The second problem happens after
| all
| work is finsihed with the BeginRequest event. In IIS5, the request for the
| .jpg is handled, and the browser is handed the image as desired. In IIS6,
| the
| request does not continue, and the image is not loaded by the browser. I
was
|
| abole to get around the problem with IIS6 by respoonse.write of the image,
| but I would much rather have IIS handle the rest of the request.
|
| Thanks,
|
|
|
|