B
Benton
Hi there,
I'm having a problem with a method which resides on a static class I have on
my ASP.NET application.
public static string FilterCenter(string fieldName)
{
string centers =
((User)System.Web.HttpContext.Current.Session["userdata"]).Centers;
...some more code...
}
The point here is how I cast Session["userdata"] to the (User) type so I can
access the Centers property. This method works fine on my development
machine with the VS 2005 web server.
However, after deploying to the Windows 2003 server, I get this exception:
[NullReferenceException: Object reference not set to an instance of an
object.]
That is, it seems that Session["userdata"] is now null. Again, this only
happens on the production IIS server.
So... am I doing something wrong here trying to access Session[] from a
static class? If not, why does it work on VS 2005 but fails on IIS 6?
Thanks in advance,
-Benton
I'm having a problem with a method which resides on a static class I have on
my ASP.NET application.
public static string FilterCenter(string fieldName)
{
string centers =
((User)System.Web.HttpContext.Current.Session["userdata"]).Centers;
...some more code...
}
The point here is how I cast Session["userdata"] to the (User) type so I can
access the Centers property. This method works fine on my development
machine with the VS 2005 web server.
However, after deploying to the Windows 2003 server, I get this exception:
[NullReferenceException: Object reference not set to an instance of an
object.]
That is, it seems that Session["userdata"] is now null. Again, this only
happens on the production IIS server.
So... am I doing something wrong here trying to access Session[] from a
static class? If not, why does it work on VS 2005 but fails on IIS 6?
Thanks in advance,
-Benton