asp.net: data put in session is available while working in internet explorer but not in opera

StackOverflow https://stackoverflow.com/questions/414488

  •  03-07-2019
  •  | 
  •  

Question

it's a really weird thing - i have a website that works perfectly in maxthon (internet explorer based browser). i started it in opera and found out that the data put in the Session dictionary on one site, is not available on the other... i mean i have Welcome.aspx, where when you click next the following code is executed:

Session["sessionData"] = sessionData;
Response.Redirect("~/Models.aspx");  

while debugging i can see that in models.aspx Session in empty when executing in opera but everything is fine when executing in maxthon. has anyone got any idea what can be wrong? because i'm clueless.. is this some opera preferences thing or is it something in code?

Edit: i checked Session.IsNewSession and while executing in maxthon isnewsession is set to false but in opera it's true. it seems that in opera when moving to a new page it somehow creates new session...

Was it helpful?

Solution

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

Response.Redirect("nextpage.asp", false);

Otherwise it wont write the whole responsestream and the cookie might not have been written. You can instead choose to have cookiless sessions. But then your open to session hijacking.

OTHER TIPS

ASP.NET session is stored by a key that is saved as a cookie in the browser. Check Opera to see if it is accepting cookies - it will need to in order for ASP.NET session to work properly.

Maybe you have cookies disabled in Opera. Session works (unless speciefies as cookieless in web.config) by storing an identifier in a cookie. If the brwoser does not allow the access, the server won't be able to locate the data

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top