c# - To check if session is available or not -


i tried code in application_error this

session["mysession"] = "some message"; 

but problem session not available in application_error. want check whether session available or not.

session doesn't exist within context of current application_error. try following:

protected void application_error(object sender, eventargs e) {     if (context.handler irequiressessionstate ||          context.handler ireadonlysessionstate)     {          // session exists          session["mysession"] = "some message";     } } 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -