asp.net - Why session in cs class file is null ? (web project .net 2010) -


i have cs class file in web project in vs 2010. in class,i read , wirte session variables. session property null!

i use this:

 public static int userid         {                         {                 if (httpcontext.current.session["userid"] == null) return 0;                 return int.parse(httpcontext.current.session["userid"].tostring());             }             set             {                 httpcontext.current.session["userid"] = value;             }          } 

but httpcontext.current.session null(no httpcontext.current.session["x"])

note web project has no app_code folder.

how use session in class?

because property static , sessions not static. can not access it.

for more informaton, see links below: msdn


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -