Search code examples
asp.netasp.net-4.0ashxgeneric-handler

Set Extension For Handler.ashx


I have a generic handler Image.ashx that crops/resizes images on the fly by reading information from the querystring like Image.ashx?filename=foo.jpg&maxwidth=200&maxheight=300.

Is there a way that I can change the extension of this handler to .jpg? (it always returns jpgs) I'd rather the calls look like this: Image.JPG?filename=foo.jpg&maxwidth=200&maxheight=300?


Solution

  • Yes, you can use the routing infrastructure to point image.jpg to image.ashx