Loosing Session variables...

  • Thread starter Thread starter Lars Netzel
  • Start date Start date
L

Lars Netzel

This is basic Session handling but it's not working.

On a Page1.aspx I have this code:
-----------------------------------
If TextBox1.Text = "admin" And TextBox2.Text = "Admin01" Then

Session("admin") = "True"

Response.Redirect("Page2.aspx")

End If

---------------------------------

On Page2.aspx I have this code
------------------------------------------------
Response.Write(Session("admin"))
------------------------------------------------

I get nothing... and if I debug, the Session("admin"´) is Nothing...

Do I need to do something to turn session handlign on?

best regards/
Lars
 
Lars said:
This is basic Session handling but it's not working.

On a Page1.aspx I have this code:
-----------------------------------
If TextBox1.Text = "admin" And TextBox2.Text = "Admin01" Then

Session("admin") = "True"

Response.Redirect("Page2.aspx")

End If

Response.Redirect (default) is destructive to Sessions...use the
overloaded Redirect, and pass "false" as the second parameter.

HTH...
Chris
 
Overloaded? What do you mean?

/Lars


Chris Hyde said:
Response.Redirect (default) is destructive to Sessions...use the
overloaded Redirect, and pass "false" as the second parameter.

HTH...
Chris
 
Possibly your browser is blocking cookies? Without allowing cookies, you
don't get session support. The alternative to is use cookie-less sessions,
which are enabled in web.config.
 
Hello, isn't the response.write to be

"Response.Write Session("admin")"

or <%= session("admin")%>

try this.
 
Back
Top