HttpHandler redirect to .aspx page RRS feed

  • Question

  • User1352039573 posted

    I am serving images using an HttpHandler, and depending on the url would like to redirect to an .aspx page that contains the style and markup (image tag) for the image.

    I was initially attempting to redirect to the aspx page. But I would like to pass through parameters for the image such as height and width. (these are in the original url)

    The other way I was considering doing this was using an HttpHandlerFactory and GetCompiledPageInstance, but I already am using an HttpHandler for the images and parsing of the url, so I thought using the redirect would be better

    What is the bext way to do this? How can I pass information to the .aspx page if it is redirected to?(in the request?) or set variables in the compiled instance of the page if I used the HttpHandlerFactory?

    Sunday, July 26, 2009 8:17 PM


  • User-525215917 posted

    If it is possible you may consider using HttpHandler to return images with correct size. Here is the example for SharePoint but it is easy to modify to fit your needs SharePoint: Creating HttpHandler for user profile images. If you want to redirect internally you can use HttpContext.Current.Rewrite() method by example. You can give there also query string parameters for the page you redirect the request.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 27, 2009 3:42 AM