ASP.NET session lost after redirect but only with IE

Gold

New Member
I am writing in C# using ASP.NET 4.0.I am authenticating user credentials via SQL lookup and if valid I am storing the username in a session variable then redirecting the user back to the main page. Pretty simple.\[code\]if (!db.isValidLogin(userName, passWord)) { //invalid login, show it! //just some code to tell the user invalid credentials } else { //show login successful! //update some items on the screen Session["username"] = userName.ToUpper(); Response.Redirect("/"); }\[/code\]This is not yet over SSL as it's internal development at this point.When I use Chrome Version "25.0.1364.172 m" I am properly redirected and I am "logged in". My screen is representative of that by showing me my user name and allowing me access to features that authentication allows.When I use (32-bit) IE 9 Version "9.0.8112.16421" with the same server side code and procedure... When I do the redirect my session variable "username" is gone. In fact the session has a count of 0 for items. BEFORE the redirect the session variable is set and it is correct.I have the same results on a Windows Server 2008 R2 64-bit box and a Windows 7 64-bit box.I am using a single server hosting both IIS and SQL. I am not using a session server.I have traced it out... the code is running exactly as desired up until the redirect. Receiving credentials, executing my stored procedure to validate... setting the session variable before redirecting (I can see the session and the variable and the value is correct).. and then redirecting... and as stated, with Chrome it works EXACTLY as desired... with IE the session is lost on redirect.I have tried this as well with no success:\[code\]Response.Redirect("/", false);\[/code\]So I'm convinced that something IE is doing, maybe with setting cookies on the client, that is causing a mismatch between the browser and the server session.Should I not be doing a response.redirect??? And if I do a response.redirect, how do I keep the session from resetting? Once again, keep in mind this doesn't happen when I use Chrome.Frustrating...Thanks for any help!
 
Back
Top