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
Post a Comment