2

I thought the session_start event in the global.asax should only fire the first time I access a page on the web site. But I noticed for in asp.net mvc3 when I go to different paths it runs every time.

Ex.

http://webserver/home/index - runs once here (link 1) 
http://webserver/contact/index - runs once here (link 2)

Do I need to configure something so session_start only runs once? I tested this by setting a session variable to current date time and displayed the session variable on the layout page. When I click on linked 1 from above it displayed a time and when I clicked on link 2 from above it displayed a time. Both times were different. Any ideas?

Thank you

MindGame
  • 1,211
  • 6
  • 29
  • 50
  • 1
    Check out this post it will answer your question [Session Start fires multiple times][1] [1]: http://stackoverflow.com/questions/7097758/session-start-firing-multiple-times-on-default-asp-net-mvc3-project – Pratik Bhatt Jan 23 '13 at 04:46
  • Thanks Pratik. That was the answer. Can you post your response below then I can mark it as the answer? – MindGame Jan 23 '13 at 17:25
  • Actually its still occurring for me. Any other ideas? – MindGame Jan 23 '13 at 18:14

1 Answers1

3

If Session_Start or Session_End handlers are not defined in the Global.asax, a new Session ID is generated for every request, when there is nothing stored in the Session bag.This is what happening in your case

similar, ASP.Net Session_Start always firing

Community
  • 1
  • 1
Cris
  • 12,799
  • 5
  • 35
  • 50