Take the 2-minute tour ×

I've got a simple ASHX handler that returns an dynamically generated image; the image is generated from a custom created class, and an object belonging to this class is passed to the handler using Session (I'd rather avoid using QueryString).

The handler is used as the URL of an image on a ASP form which is very simple: a drop down list, a button and an image. Basically, depending on what the user selects from the list, the appropriate image will be generated once the button is pressed.

At the start the actual image has it's Visible property set to false; I don't want the handler to display anything before the data is all there.

Once the button is pressed, the required Session parameter is added containing the necessary object, and the page is refreshed using Server.Transfer. When the Page_load method detects that the Session parameter has been correctly set, it sets the Visible parameter on the image to true.

After that the handler fires up and generates the image.

So far so good... However, if the user now picks something different from the list and presses the button, despite the correct object being passed in the Session, the image won't be updated. In fact, the handler won't even fire up (if I put a breakpoint in there). I need to close the browser window and reopen it for it to work.

Any ideas what could be the cause of such behaviour?

I suspect the answer is very simple, and I just don't know something fundamental about ASP (or handlers)...

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The image is probably cached on the client and the browser didn't bother to request a new version from the server. At the beginning of the ProcessRequest method add:

share|improve this answer
beat me to it.. –  Ed B Jun 23 '10 at 20:32
add comment

Your Answer


