Session_Start does not appear to fire

J

jcode

I have an ASPNET application that has worked correctly on couple of
servers. I have just deployed it to another server and cannot resolve
an issue.

It appears as if the Session_Start is not firing or session state is
not being maintained.

First lines of Session_Start:

string loc = "LoadSettings";
Session.Add("Session_Start_Loc", loc);

Inside Page_Load of first page to be displayed:

try
{
sessionerr = Session["Session_Start_Loc"].ToString();
lblExc.Text += " Session_Start_Loc=" + sessionerr;
}
catch(Exception ex1){lblExc.Text += " Exception in Session_Start_Loc="
+ex1;}

try
{
Session.Add("Test", "Test");
lblExc.Text += " Test=" + Session["Test"].ToString();
}
catch {lblExc.Text += " Test=Failed to retrieve";}

The result is: Exception in
Session_Start_Loc=System.NullReferenceException: Object reference not
set to an instance of an object. at
Pharmacy.ComingSoon.Page_Load(Object sender, EventArgs e) Test=Test.

This means to me that either the Session_Start is not firing or the
Session is not being maintained. Any ideas?

I believe it is some kind of configuration issue.
 
G

Guest

jcode,
try adding an item to Session from somewhere OUTSIDE of the Session_Start
handler, say in Page_Load.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top