How to easily redirect if not authenticated in MVC 3?

前端 未结 4 642
夕颜
夕颜 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条回答
  •  难免孤独
    2021-01-01 14:04

    You can put the [Authorize] attribute over each action that needs to be authenticated.

    Also, make sure that this section is defined in your Web.Config:

    
      
    
    

提交回复
热议问题