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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -