c# - session expiring and throwing exception -
I have an issue with the end of the season First it expires every 20 minutes and it throws an error. ..
I tried to fix it by:.
if (session ["user name"] toString () == tap) {session. Response.Redirect ("~ / Login.aspx? SessionError =" + "session ended on pageload please please do again"); }
But I get the following error:
Object reference not set to an instance of an object
My stack trace is:
[NullReferenceException:. Object reference not set to an instance of an object] in copiunGUI.Site1.checksession (C): \ Users \ jagmit \ Documents \ Projects \ \ copiunGUI \ copiunGUI \ Site1.Master.cs Visual Studio 2008: 224 copiunGUI C. Site1.TreeViewMain_Unload (object sender, EventArgs e): \ Users \ jagmit \ Documents \ visual Studio 2008 \ projects \ copiunGUI \ copiunGUI \ Site1.Master.cs: 210 System.Web.UI.Control.OnUnload (EventArgs e) 8,681,754 System .Web.UI.Control.UnloadRecursive (Boolean Settlement) +252 System.Web.UI. Control.UnloadRecursive (Boolean dispose) 188 System.Web.UI.Control.UnloadRecursive (Boolean dispose) 188 System.Web.UI.Control.UnloadRecursive (Boolean dispose) 188 System.Web.UI.Control.UnloadRecursive (Boolean settlement) 188 System.Web.UI.Page.UnloadRecursive (Boolean dispose) +23 System.Web.UI.Page.ProcessRequestCleanup () +43
I web.config
Is:
> & lt; Authentication mode = "form" & gt; & Lt; Forms loginUrl = "Login.aspx" defaultUrl = "~ / Default.aspx" name = "cookie" timeout = "10080" path = "/" & gt; & Lt; / Forms & gt; & Lt; / Authentication & gt; & Lt; Authority & gt; & Lt; Deny users = "?" / & Gt; & Lt; Allow users = "*" /> & Lt; / Authorization & gt;
Please help .......
thanks
Thank you for ur input people ...
I tried to do this:
if (session ["user name"] == tap) {session Revove (All); Response.Redirect ("~ / Login.aspx? SessionError =" + "session ended on pageload please please do again"); }
But I get an error:
The response is not available in this context.
The problem is here:
if (session ["User name"]. ToString () == faucet)
When the session ["user name"] is an empty object reference, you can not call properly. Toastring () on it
Try it instead ...
if (session ["user name"] == empty) ...
< / Div>
Comments
Post a Comment