c# - How to access the session declared in Session_Start in Global.asax file in another class file in asp.net -


##global.asax file ## 

this global.asax file writing session variable

protected void session_start(object sender, eventargs e){     session["myname"] = "something";             } 

the class below located in separate library in same solution

    --------------------------------------------       ## myclass.cs ##      using system.web;     public class myclass{          public string method()         {             string x = httpcontext.current.session["myname"];             return x;         }     } 

but here session value null. unable populate string.

please let me know doing wrong.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -