views:

280

answers:

3

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...

A: 

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.

Andrew Hare
well i thought about it and checked it and yes, opera supports cookies...
agnieszka
I would check opera and look for the actual cookie to make sure it was accepted - you ought to be able to see an ASP.NET session cookie from your domain.
Andrew Hare
A: 

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

Manu
A: 

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.

Richard L
still doesn't work
agnieszka
but cookieless session solved the problem. thanks!
agnieszka