Note that there are some explanatory texts on larger screens.

plurals
  1. POsession expiring and throwing exception
    text
    copied!<p>I have a problem with session expiry. Firstly it expires every 20 minutes and it throws an error...</p> <p>I tried to fix it by:</p> <pre><code>if (Session["userName"].ToString() == null) { Session.RemoveAll(); Response.Redirect("~/Login.aspx?sessionError=" + "*Session Expired on pageload PleaseLog in again"); } </code></pre> <p>But I get the following error:</p> <blockquote> <p>Object reference not set to an instance of an object. </p> </blockquote> <p>My stack trace is:</p> <blockquote> <p>[NullReferenceException: Object reference not set to an instance of an object.] copiunGUI.Site1.checksession() in C:\Users\jagmit\Documents\Visual Studio 2008\Projects\copiunGUI\copiunGUI\Site1.Master.cs:224 copiunGUI.Site1.TreeViewMain_Unload(Object sender, EventArgs e) in C:\Users\jagmit\Documents\Visual Studio 2008\Projects\copiunGUI\copiunGUI\Site1.Master.cs:210 System.Web.UI.Control.OnUnload(EventArgs e) +8681754 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +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 dispose) +188 System.Web.UI.Page.UnloadRecursive(Boolean dispose) +23 System.Web.UI.Page.ProcessRequestCleanup() +43</p> </blockquote> <p>My <code>web.config</code> is:</p> <pre><code>&lt;authentication mode="Forms"&gt; &lt;forms loginUrl="Login.aspx" defaultUrl="~/Default.aspx" name="Cookie" timeout="10080" path="/"&gt; &lt;/forms&gt; &lt;/authentication&gt; &lt;authorization&gt; &lt;deny users="?"/&gt; &lt;allow users="*"/&gt; &lt;/authorization&gt; </code></pre> <p>Please help.......</p> <p>Thanks</p> <p>Thanks for ur input guys...</p> <p>I tried this:</p> <pre><code>if (Session["userName"] == null) { Session.RemoveAll(); Response.Redirect("~/Login.aspx?sessionError=" + "*Session Expired on pageload PleaseLog in again"); } </code></pre> <p>But i get the error:</p> <blockquote> <p>Response is not available in this context.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload