R
R.A.M.
Hello,
I have created ASP.NET project in which I have a file Admin.cs. It contains
static class Admin with some methods and properties. The problem is that in
property get a reference HttpContext.Current.Session is null, although for
instance HttpContext.Current.Application or HttpContext.Current.Request is
not null:
public static class Admin
{
...
set
{
HttpContext.Current.Session["Database"] = value; // HERE OK
}
get
{
object db = HttpContext.Current.Session["Database"]; // HERE PROBLEM
if (db == null)
return null;
return db.ToString();
}
...
}
Could anyone explain me why? How to use Session object in my code?
/RAM/
I have created ASP.NET project in which I have a file Admin.cs. It contains
static class Admin with some methods and properties. The problem is that in
property get a reference HttpContext.Current.Session is null, although for
instance HttpContext.Current.Application or HttpContext.Current.Request is
not null:
public static class Admin
{
...
set
{
HttpContext.Current.Session["Database"] = value; // HERE OK
}
get
{
object db = HttpContext.Current.Session["Database"]; // HERE PROBLEM
if (db == null)
return null;
return db.ToString();
}
...
}
Could anyone explain me why? How to use Session object in my code?
/RAM/