asp.net - How to easily redirect if not authenticated in MVC 3? -


i brand new asp.net, , i'm trying find way redirect unauthenticated user page on site logon page. prefer not put following code in every http function if there option.

if (!request.isauthenticated) {      return redirecttoaction("logon", "account"); } 

mark controller [authorize] attribute http://msdn.microsoft.com/en-us/library/system.web.mvc.authorizeattribute.aspx

see web.config, default should have forms authentication turned on authentication mode="forms" http://msdn.microsoft.com/en-us/library/eeyk640h.aspx

also @ question asp.net mvc authorization

in case if want have custom authorize behavior here customizing authorization in asp.net mvc


Comments

Popular posts from this blog

jQuery Ajax Render Fragments OR Whole Page -

javascript - Iterate over array and calculate average values of array-parts -

java - Simple Command Line calculator -