Visual Basic .NET » Visual Basic .NET General Discussion
Session Error ... -- Raj --


Hi,

I have 2 projects under 1 solution 1>WebServices 2>WebProject(test) which access this webservices

In WebServices when I try to put something in session it throws error "Object reference not set to instance of Object"

Following line of code throws error:

SomeClass()
{
ArrayList AL = new ArrayList();

HttpContext.Current.Session
= AL; <-- here is where it throws error
}

Earlier I had same thing working when these 2 projects were separate
... soon I bought under same solution started throwing this error .....

Raj

-- Raj --


I just noticed I create new WebServices with the simple "Hello World"example and thr to put variable in session throws error !

public string HelloWorld()
{
try
{
Session.Add("temp", "temp"); <-- THIS WILL THROW ERROR
}
catch (Exception ex)
{
string exmessage = ex.Message;
}

return "Hello World";
}
Raj

-- Raj --


Got the solution ;)

Set EnableSession=true in WebMethod attribute

would enable the session state

Raj

[Submit Comment]Home