Session not being displayed

T

tshad

I am trying to set a session variable an find that the session variable
doesn't get set until I refresh the page.

I am trying to display an image with text on it (Captcha) and need to save
the text that gets printed. Each time the page gets refreshed a new random
number is used. I save this to session variable, but the page doesn't seem
to have it until I refresh. Each refresh gets me the previous number.
Doesn't really help me.

I have a page that calls a User Control which loads the image (which is
really a .aspx page) that outputs the image in the response stream.

The flow is something like:

************************************************
NewPage

Calls User Control - which has <img src="jpegImage.aspx"> in it.

Loads jpegImage.aspx from the img statement.

Calls dll and passes random number to use.
Dll writes number into session variable.
Dll creates the image and passes it back

Sets up the response pipe:
Response.Clear()
Response.ContentType = "image/jpeg"

' Write the image to the response stream in JPEG format.
ci.Image.Save(Response.OutputStream, ImageFormat.Jpeg)

Image is displayed (no session variable in trace).
If hit refresh, previous number in trace.
*****************************************************

Why isn't the session variable there before hitting the refresh?

Thanks,

Tom
 
T

tshad

I tried putting the Session call in the jpegImage.aspx, but the same thing
happens.

It is always one page behind.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top