Is it possible to skip the HttpHandler if there is no request?

I wrote dynamic image changing as HttpHandler. It automatically calls something with an image extension, for example, for example:

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

it starts the handler and returns a sketch with the corresponding response headers. However, I want the handler to skip the pass request if it called without a request:

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

I want this to return an image with header information, as if it were not being run through a handler. Is it possible, without having to manually encode the header information (which includes opening threads to read data, such as the date of the last record), or do I need to convert the handler to instead HTTPModule?

+3
source share
2 answers

The handler must "process" the request. This is the end of the chain. You either need to make it an HttpModule, or you need to service the image yourself, regardless of whether you resize it or not.

+4
source

Could you just configure the handler to account for this case? You can just make sure that there are no query string parameters and just map the request path to the disk and return the image directly by opening it and just write to the output stream.

+1
source

Source: https://habr.com/ru/post/1714109/


All Articles