473,394 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 1330
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steve | last post by:
let's say that I have a webpage with an <img> tag and it has an invalid src attribute, that is the image it points to doesn't exist. Is there any way to catch stuff like that and handle it? For...
3
by: Jed | last post by:
I have written an HttpHandler which I invoke through an ashx page. The HttpHandler does various things to process the request, then it is supposed to redirect to a confirmation page. Everything...
6
by: David Bowey | last post by:
Hi There! I'm writing a custom HttpHandler to create watermarks on my PNG images of my website. So typically, a PNG image is linked in an ASPX page as follows... <img src="images/test.png"...
7
by: Adam | last post by:
Im trying to add an httphandler for all *.sgf file extensions. I have developed the handler, 1. installed it into the gac 2. added it to the machine.config: <httpHandlers> <add verb="*"...
2
by: Alexandre | last post by:
Hi, I have created an HTTPHandler in ASP.NET 2.0 I now the way to add it in the web.config but my question will be stupid... when I compile my application in asp.net 2.0 from vs 2k5... umm...
3
by: Jeeran | last post by:
I need to perform url rewriting to convert this (for example): /blogs/feeds/popular/posts/ to this: /blogs/feeds.aspx?type=popular&type2=posts What I did was the following: 1. Created an...
5
by: zlf | last post by:
Hello, I try to use a custom HttpHandler to add something to session, then display the original page. public void ProcessRequest(HttpContext context) { context.Session = "test"; } But, a...
2
by: wickedHangover | last post by:
I'm writing some code to act as a proof of concept which at this point works ok, there is a minor issue I would like to resolve. What I have is an image database being served in an academic...
6
by: David | last post by:
Hi, I'm very new to ASP.NET. I have over 10 years of C++ experience in MFC and Games programming etc, but web programming is something I have just started. Sorry for the rather silly...
5
by: Author | last post by:
I followed the example at http://support.microsoft.com/kb/308001/EN-US/ and created my own HttpHandler. Here is the code: using System.Web; namespace MyNameSpace { public class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.