Session timeout in Web [modified]
-
Dear friends, My ASP.Net site works perfectly in local network. But after uploading in the net, session times out frequently. I have 2 session variable.One is declared ( CompanyTitle) at Global.asax(Session_Start event), another in login page ( userName). The session variable declared in Global.asax is available in all pages, the other variable is not. It gives an error as "Object variable is not set to an instance.....". After that I declared this variable in Global.asax(Session_Start event) with "" as its default value. Now the problem is that the UserName session variable is reset into "" frequently. my session entry in web.config is as <sessionstate mode="InProc" cookieless="UseCookies" timeout="60" /> Please advice me on this problem.
Shivanandan C V
modified on Monday, April 13, 2009 1:32 AM
-
Dear friends, My ASP.Net site works perfectly in local network. But after uploading in the net, session times out frequently. I have 2 session variable.One is declared ( CompanyTitle) at Global.asax(Session_Start event), another in login page ( userName). The session variable declared in Global.asax is available in all pages, the other variable is not. It gives an error as "Object variable is not set to an instance.....". After that I declared this variable in Global.asax(Session_Start event) with "" as its default value. Now the problem is that the UserName session variable is reset into "" frequently. my session entry in web.config is as <sessionstate mode="InProc" cookieless="UseCookies" timeout="60" /> Please advice me on this problem.
Shivanandan C V
modified on Monday, April 13, 2009 1:32 AM
Shivan Nandan wrote:
my session entry in web.config is as
you web.config setting is not coming properly. While posting web.config setting, make sure you have checked "Ignore HTML tags in this message (good for code snippets)" Check box.
Shivan Nandan wrote:
But after uploading in the net, session times out frequently.
You want to mean after deployed into IIS?
Shivan Nandan wrote:
the other variable is not. It gives an error as "Object variable is not set to an instance.....".
How did you add the value in session?
Shivan Nandan wrote:
Now the problem is that the UserName session variable is reset into "" frequently.
Means you are getting the value some times and its got reset frequently. Are you using any Application Pool in IIS ? Does it recycling for any reason ?
cheers, Abhijit CodeProject MVP
-
Shivan Nandan wrote:
my session entry in web.config is as
you web.config setting is not coming properly. While posting web.config setting, make sure you have checked "Ignore HTML tags in this message (good for code snippets)" Check box.
Shivan Nandan wrote:
But after uploading in the net, session times out frequently.
You want to mean after deployed into IIS?
Shivan Nandan wrote:
the other variable is not. It gives an error as "Object variable is not set to an instance.....".
How did you add the value in session?
Shivan Nandan wrote:
Now the problem is that the UserName session variable is reset into "" frequently.
Means you are getting the value some times and its got reset frequently. Are you using any Application Pool in IIS ? Does it recycling for any reason ?
cheers, Abhijit CodeProject MVP
Hi, After deploying also , I get the same kind of error.But now I have uploaded all files ie, aspx,aspx.cs,cs,web.config,Global.asax etc. The first variable is added in Session_Start event, as Session.Add("CompanyTitle","XYZ") The other variable in protected void btnLogin_Click(object sender, EventArgs e) { // value retrieval code from Database Session["UserName"]=UserName; } The problem is that whenever I retrieve the session variable "UserName" in some other page, nearly after 1 minute it gives the error "Object variable not set to an instance..." Shivanandan C V
-
Hi, After deploying also , I get the same kind of error.But now I have uploaded all files ie, aspx,aspx.cs,cs,web.config,Global.asax etc. The first variable is added in Session_Start event, as Session.Add("CompanyTitle","XYZ") The other variable in protected void btnLogin_Click(object sender, EventArgs e) { // value retrieval code from Database Session["UserName"]=UserName; } The problem is that whenever I retrieve the session variable "UserName" in some other page, nearly after 1 minute it gives the error "Object variable not set to an instance..." Shivanandan C V
Shivan Nandan wrote:
The problem is that whenever I retrieve the session variable "UserName" in some other page, nearly after 1 minute it gives the error "Object variable not set to an instance..."
It means you are getting the value from session for sometimes. Yes | No ? Did you gone through all the questions that I have asked you earlier ? What is IIS settings fro Session Time Out, What about IIS Recycling ?
cheers, Abhijit CodeProject MVP
-
Shivan Nandan wrote:
The problem is that whenever I retrieve the session variable "UserName" in some other page, nearly after 1 minute it gives the error "Object variable not set to an instance..."
It means you are getting the value from session for sometimes. Yes | No ? Did you gone through all the questions that I have asked you earlier ? What is IIS settings fro Session Time Out, What about IIS Recycling ?
cheers, Abhijit CodeProject MVP
Hosting people told that they have set it to 60 minutes. About recycling I have no idea.
Shivanandan C V
-
Hosting people told that they have set it to 60 minutes. About recycling I have no idea.
Shivanandan C V
Shivan Nandan wrote:
About recycling I have no idea.
If you are confident about your code, then problem is only with the recycling of Application Pool. Ask you hosting people to create a separate application pool for you site and assign that application pool to your site, and then test. Good luck !!
cheers, Abhijit CodeProject MVP
-
Shivan Nandan wrote:
About recycling I have no idea.
If you are confident about your code, then problem is only with the recycling of Application Pool. Ask you hosting people to create a separate application pool for you site and assign that application pool to your site, and then test. Good luck !!
cheers, Abhijit CodeProject MVP
Thank You
Shivanandan C V