开发者

Custom Authentication on a Controllers Action Methods

开发者 https://www.devze.com 2022-12-08 04:44 出处:网络
I\'m new to asp.net mvc and I was wondering if there was any clean non repetitive way of running a check to see whether a user 开发者_如何转开发is logged in when any Action Method on a particular cont

I'm new to asp.net mvc and I was wondering if there was any clean non repetitive way of running a check to see whether a user 开发者_如何转开发is logged in when any Action Method on a particular controller is invoked? Also is there a way to stop that method from being invoked and redirecting the user to a specified page? I'm using a custom authentication method (not Membership Provider) and i'm having trouble finding examples for this type of implementation.

Thanks in advance


Check the [Authorize] attribute System.Web.Mvc.AuthorizeAttribute. Also, the template ASP.NET MVC application created in Visual Studio contains a controller illustrating authorization/authentication techniques.

0

精彩评论

暂无评论...
验证码 换一张
取 消