i have a cs class file in a web project in vs 2010. in class,i read and wirte session variables. but my Session property is null!
i use this:
public static int UserID
{
get
{
if (HttpContext.Current.Session["UserID"] == null) return 0;
return int.Parse(HttpContext.Current.Session["UserID"].ToString());
}
set
{
HttpContext.Current.Session["UserID"] = value;
}
}
but my HttpContext.Current.Session is null(no HttpContext.Current.Session["x"])
note web project has no App_Code folder.
how to use session in my class?