Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to skip a HttpHandler if there is no querystring?

I wrote a dynamic image resizer as a HttpHandler. It's automatically called on anything with an image extension, so for example:

http://www.mysite.com/picture.jpg?width=200&height=100

will run the handler and return a thumbnail image with the proper response headers. However, I want the handler to let a request 'pass through' if it's called without a querystring:

http://www.mysite.com/picture.jpg

I want this to return the image with the header information like it would be if it didn't run it through the handler. Is this possible without having to manually code in the header information (which involves opening filestreams to read data such as last written date), or do I have to convert my handler to a HTTPModule instead?

like image 461
Daniel T. Avatar asked Jan 31 '26 10:01

Daniel T.


1 Answers

A handler has to "handle" the request. It's the end of the chain. You either need to make it an HttpModule, or you need to serve the image yourself, whether or not you resize it.

like image 98
John Saunders Avatar answered Feb 02 '26 23:02

John Saunders



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!