471,056 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,056 software developers and data experts.

HttpHandler Question

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.
Mar 14 '06 #1
3 1256
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)

"preport" <pr*****@newsgroups.nospam> wrote in message
news:Ov*************@TK2MSFTNGP10.phx.gbl...
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.

Mar 14 '06 #2
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)


Mar 15 '06 #3
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...c31-41d7-9dc4-
efa83f813521.asp?frame=true

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

http://msdn.microsoft.com/library/de...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.)

Mar 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jed | last post: by
2 posts views Thread by Alexandre | last post: by
6 posts views Thread by David | last post: by
5 posts views Thread by Author | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.