views:

169

answers:

1

Hi, I have found this thread which describes a very interesting OnSessionStart event, but I am unable to "hook" it up (whatever it means) to my global.asax.cs. I am also unsuccessful while searching the web for it. So could someone please explain to me, if the event really exists in asp.net mvc, where do I get it (inherit or what from where) and where do I put it?

Thanks in advance.

+2  A: 

It looks like this:

void Session_Start(object sender, EventArgs e) {
  // your code here, it will be executed upon session start
}

It does work in Asp.net MVC.
Put it as a method in the class defined in Global.asax.cs, for example just after the RegisterRoutes method.

You can find a complete list of methods for global.asax here: http://articles.techrepublic.com.com/5100-10878%5F11-5771721.html They all have the same signature (void MethodName(object sender, EventArgs e))

Palantir