views:

55

answers:

1

Hi all,

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

+1  A: 

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.

SevenCentral
Do you have any examples on how to use the Authorize attribute on a custom authentication? I'm not using ASP.Net's MembershipProvider and every article that i've come across regarding the Authorize attribute makes use of the Membership Provider.
zSysop