Session_start firing on first two page impressions?
I have a website which is behaving oddly in terms of creating new sessions开发者_开发技巧. When I fire up the website, the Session_Start event fires as you would expect and the page loads fine. No error is encountered and everything runs fine. The next time you click a link to cause a new page to load, Session_Start fires again and a new session is initialised, losing the data from the previous page impression. Thereafter, you can navigate around the site as much as you want and the session remains consistent, never firing Session_Start again until you would expect (new browser window etc.). and visiting the same page as the site started with without this happening again.
I can’t see anything obvious as to why it would do this, but I need to resolve it as it is making session tracking inaccurate, and its driving me nuts as I can’t explain why. Has anyone seen this or is anyone able to offer a theory as to why?
Thanks
Asp.net sessions are handled using cookies, a cookie (typically) named ASP.NET_SessionId. If the second request its issued before the cookie is set the first time, you'll get a new session. If this is not the case, follow/inspect the value of the asp.net session cookie using a browser tool like Firebug.
精彩评论