How to easily redirect if not authenticated in MVC 3?

前端 未结 4 641
夕颜
夕颜 2021-01-01 14:00

I am brand new to ASP.NET, and I\'m trying to find a way to easily redirect an unauthenticated user from any page on the site to the logon page. I would prefer to not put th

4条回答
  •  旧时难觅i
    2021-01-01 14:10

    I just tried this:

    
    
      
    
    

    and it still works, although I'm using custom auth. Not sure about timeout though - will [Authorize] still use the default one for Forms Auth or it won't manage timeouts at all (preferred behavior for custom auth).

提交回复
热议问题