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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -