Connecting Tech Pros Worldwide Help | Site Map

Session not being displayed

tshad
Guest
 
Posts: n/a
#1: Jun 26 '06
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


tshad
Guest
 
Posts: n/a
#2: Jun 27 '06

re: Session not being displayed


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

It is always one page behind.

Tom

"tshad" <tscheiderich@ftsolutions.com> wrote in message
news:uAGK2sVmGHA.4164@TK2MSFTNGP03.phx.gbl...[color=blue]
>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
>
>[/color]


Closed Thread