Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC Session timeout issue
    primarykey
    data
    text
    <p>Am new to MVC. Am redirects page to login page at the time of sessionout. But i am getting below error when i copy the URL from one browser to another browser. </p> <pre><code>[NullReferenceException: Object reference not set to an instance of an object.] ASP._Page_Views_Shared__Layout_cshtml.Execute() in c:\Users\sathish\AppData\Local\Temp\Temporary ASP.NET Files\citrusz\c8f40333\adcdafd9\App_Web_vbginoqd.3.cs:0 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +97 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +88 System.Web.WebPages.&lt;&gt;c__DisplayClass7.&lt;RenderPageCore&gt;b__6(TextWriter writer) +233 System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +10 System.Web.WebPages.WebPageBase.Write(HelperResult result) +71 System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +64 System.Web.WebPages.WebPageBase.PopContext() +246 System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +95 System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +260 System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +115 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +295 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13 System.Web.Mvc.&lt;&gt;c__DisplayClass1a.&lt;InvokeActionResultWithFilters&gt;b__17() +23 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242 System.Web.Mvc.&lt;&gt;c__DisplayClass1c.&lt;InvokeActionResultWithFilters&gt;b__19() +21 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +242 System.Web.Mvc.&lt;&gt;c__DisplayClass1c.&lt;InvokeActionResultWithFilters&gt;b__19() +21 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass2a.&lt;BeginInvokeAction&gt;b__20() +89 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass25.&lt;BeginInvokeAction&gt;b__22(IAsyncResult asyncResult) +102 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43 System.Web.Mvc.&lt;&gt;c__DisplayClass1d.&lt;BeginExecuteCore&gt;b__18(IAsyncResult asyncResult) +14 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47 System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10 System.Web.Mvc.&lt;&gt;c__DisplayClass8.&lt;BeginProcessRequest&gt;b__3(IAsyncResult asyncResult) +25 System.Web.Mvc.Async.&lt;&gt;c__DisplayClass4.&lt;MakeVoidDelegate&gt;b__3(IAsyncResult ar) +23 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629708 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +155 </code></pre> <p>I have used following class for session timeout handling</p> <pre><code> public class SessionExpireFilterAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpContext ctx = HttpContext.Current; if (ctx.Session != null) { if (ctx.Session.IsNewSession) { string sessionCookie = ctx.Request.Headers["Cookie"]; if ((null != sessionCookie) &amp;&amp; (sessionCookie.IndexOf("ASP.NET_SessionId") &gt;= 0)) { ctx.Response.Redirect("/Login/Logout"); } } } base.OnActionExecuting(filterContext); } } </code></pre> <p>This is my part of _layout.cshtml page.</p> <pre><code> &lt;a data-toggle="dropdown" href="#" class="dropdown-toggle"&gt; &lt;img class="nav-user-photo" src="@Session["FlagURL"].ToString()" alt="Jason's Photo" /&gt; &lt;span class="user-info"&gt; &lt;small&gt;Welcome,&lt;/small&gt; @Session["Name"].ToString() &lt;/span&gt; &lt;i class="icon-caret-down"&gt;&lt;/i&gt; &lt;/a&gt; </code></pre> <p>Please help me to resolve this issue</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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