asp.net mvc - Umbraco MVC - how can I override globa Authorize filter in controller? -


i secure whole website every page except login page require user authenticated. in order achieve this, register authorize filter @ application startup:

public static void registerglobalfilters(globalfiltercollection filters) {     filters.add(new authorizeattribute()); } 

now there problem logincontroller, despite applying [allowanonymous] attribute , still requires user authenticated. login controller:

[allowanonymous] public class logincontroller : surfacecontroller {     public logincontroller()     {     }      [httppost]     [validateantiforgerytoken]             [allowanonymous]     public async task<actionresult> handlelogin(loginmodel model, string returnto)     {         return currentumbracopage();     } } 

there no other child actions on page , problem definitively logincontroller. happens here , how can fixed?

update: views are

login page template:

@inherits umbraco.web.mvc.umbracotemplatepage @{     // layout = "master.cshtml";     layout = null; }     <div>@umbraco.field("bodytext")</div>     @html.partial("login") 

login partial is:

@using clientdependency.core.mvc @using playproj.presentation.controllers @using umbraco.web @using umbraco.web.models  @{     var loginmodel = new loginmodel();      html.enableclientvalidation();     html.enableunobtrusivejavascript();      html         .requiresjs("~/scripts/jquery.validate.hooks.js", 200)         .requiresjs("~/scripts/foundation.form.validation.js", 201); }  @using (html.beginumbracoform<logincontroller>("handlelogin", null, new { @class = "loginform", autocomplete = "off" })) {     <fieldset>         <legend>login</legend>          <button>login</button>     </fieldset> } 

rather registering global filter, maybe swap out default controller 1 has authorize attribute on. default pages don't have hijacked route routed through new authorized default controller. can change default controller in umbraco during applicationstarting event so:

defaultrendermvccontrollerresolver.current.setdefaultcontrollertype(typeof(yourdefaultcontroller)); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -