Posts Tagged ‘C#’

Data put in session is not available in C#

January 17, 2011 Leave a comment

I have a login page, aftter entering login details,
the following code is executed:
Session[“userData”] = userData;

while debugging i can see that in welcome.aspx Session is empty.

After searchinga lot on gooogle I found the solution:

If your write the session on the first hit then you should do

Response.Redirect(“welcome.aspx”, false);

Otherwise it wont write the whole response stream and the cookie might not have been written.

Categories: C#, General Tags: ,