0

I have a HttpHandler that is called whenever an image extension is accessed. This is what I have in the HttpHandler as a simple test:

public void ProcessRequest(HttpContext context)
{       
    context.Response.Write(context.Request.Url.ToString());
    context.Response.End();
}

According to Firebug, the first time the page is refreshed (Ctrl+F5), the URL is shown correctly in the response. However, if I refresh it again (F5), it'll repeat the URL 3 times:

First time:

http://server/image.jpg

Subsequent times:

http://server/image.jpghttp://server/image.jpghttp://server/image.jpg

Does anyone know why this is happening?

Daniel T.
  • 37,212
  • 36
  • 139
  • 206
  • I have a similar problem with a normal webform's Page_load called twice if there's an Image control that has an empty ImageUrl. For your case, I'm very puzzled as well, have you performed a debug and step-through? – o.k.w Aug 05 '09 at 02:46
  • I can't remember how I fixed the problem, but it was completely unrelated to writing the URL. – Daniel T. Aug 26 '09 at 22:21

1 Answers1

0

I tried your code and refresh page in different browsers and there is no repeating URL.

Anwar Chandra
  • 8,538
  • 9
  • 45
  • 61
  • Turns out I set the wrong ContentType (it was setting it as `image.png?width=250`). Dunno why this would produce 3 times the request URL on a refresh though. – Daniel T. Aug 05 '09 at 01:37