HttpHandler Question

P

preport

So I wrote an HttpHandler that does a bunch of processing then writes a gif
to the HttpContext.

What I want to do is have my handler intercept any requests for *random.gif
How might I go about getting this to work? Of course my handler works
perfect on my dev machine....because I added this to the web.config:

<add verb="*" path="*random.gif" type="Assembly.Handler" />

So all the requests for normal images works, and *random.gif gets picked up
by my handler...But as soon as I put it on a test server it didn't work
(assuming it is because I have to add the ISAPI extention). As a result I
associated the gif extention to the aspnet_isapi, but then it executes on
all images (as I expected but tried anyways).

Hopefully I got my point across. Any suggestions on how to get my handler
to intercept *random.gif.
Paths can be anything from http://blabla.com/what/is/this/random.gif or
http://blabla.com/random.gif

Any suggestions would be appreciated.
 
B

Bruce Barker

you have to add .gif the to asp.net mapping map in IIS for your vdir. the
next major release of iis will allow this to be set in the web config.

-- bruce (sqlwork.com)
 
P

preport

That's not going to work in my situation.....because like I said it might be
in

http://blabla.com/what/is/this/random.gif or http://blabla.com/random.gif

Can I do the exact opposite...like register the handler everywhere EXCEPT my
/image/ folder?

Can I go into the images folder and do something in the ISAPI filters? Like
add the .gif extention to some arbitrary dll or static file handler or
something (yes...I think I did make half of that up......static file
handler????? hahaha)
 
S

Steven Cheng[MSFT]

Hi Preport,

Thank you for posting.

Regarding on your scenario, you want only some particular requests for
"gif" extension (xxxrandom.gif) to be processed by your ASP.NET handler,
but let other gif requests still be processed by IIS. Based on my
experience, such task is hard to be done directly at ASP.NET level or
through IIS extension(since it only support a basic extension setting
".xxx"). I think you may need to consider developing a custom IIS isapi
filter if you want to intercept some particular requests to gif file be
handled by your particular handler , but remain others be processed by IIS.
Here are some resource about IIS isapi filter:

#ISAPI Filter Overview
http://msdn.microsoft.com/library/en-us/iissdk/html/22e3fbfb-1c31-41d7-9dc4-
efa83f813521.asp?frame=true

http://www.microsoft.com/msj/0498/iis/iis.aspx

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HT
ML/_core_isapi_extensions.3a_.filters.asp


BTW, if you think it ok to make all the gif files requests to be handled by
ASP.NET runtime, you can consider use different handlers to handle
different kind of gif requests( static file handler and your custom
handler).

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top