2012-06-08 53 views
1

我想在我的LogOn頁面上顯示會話超時消息。當會話超時在asp.net mvc3登錄時在LogOn頁面上顯示消息

我有覆蓋asp.net mvc授權屬性naviagate用戶登錄會話timeOut登錄頁面,但我的問題是,我無法設置視圖數據或ViewBag或會話[「消息」] 類裏面的東西覆蓋方法。

我會請各位幫我...

如何設置ViewData的重寫方法內。下面

是我CustomAuthorizeAttribute類

public class CustomAuthorizeAttribute : AuthorizeAttribute 
    { 

     public override void OnAuthorization(AuthorizationContext filterContext) 
     { 
      if (filterContext == null) 
      { 
       throw new ArgumentNullException("filterContext"); 
      } 

      if (!filterContext.HttpContext.User.Identity.IsAuthenticated || SessionCache.User_ID == 0) 
      { 
       // User not logged in, redirect to login page 
       filterContext.Result = new HttpUnauthorizedResult(); 
       return; 
      } 

     } 

    } 

請建議。

謝謝,

+0

發佈您的授權屬性代碼 – VJAI

+0

會話超時時會發生什麼? – VJAI

+0

Mark將於本週一發佈我的授權屬性代碼.... – aamankhaan

回答

0

你想看看你的Global.asax中使用Session_End事件。

認識到Session_End只會在InProc會話上被調用是很重要的。

相關問題