Where to declare Session variable in ASP.Net? Global.ASAX?

Last Reply on Nov 02, 2015 07:12 AM By Shashikant

Posted on Nov 02, 2015 07:12 AM


Hi Sir,

     I heard that Global.asax file is optional in asp.net web application.  But, if we need to declare any session variables in my website, do i really need to add Global.asax file and initialize session variables inside Session_Start() ?

Please suggest.


Posted on Nov 02, 2015 07:12 AM Modified on on Nov 30, 2015 09:30 AM

It is not necessary but you can declare Session variables in the following event.

protected void Session_Start(object sender, EventArgs e)