2012-06-08 52 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会话上被调用是很重要的。

相关问题