asp.net - Custom Role Provider not called. What am I doing wrong? -


so i'm trying create hello world custom role provider-solution in asp.net mvc 4.

basically i've set authentication mode="windows" in web.config along defining role provider this:

<rolemanager enabled="true" defaultprovider="myroleprovider">     <providers>         <clear />         <add name="myroleprovider"  type="myproject.code.myroleprovider" />     </providers> </rolemanager> 

then i've decorated about controller method this:

[authorize(roles = "somerole")] public actionresult about() { /* ... */ }  

the custom roleprovider-class looks this:

namespace myproject.code { public class myroleprovider : roleprovider {     public override bool isuserinrole(string username, string rolename)     {         if (rolename == "somerole" && username = "administrator") return true;         return false;     }      public override string[] getrolesforuser(string username)     {         return new string[] { "somerole" };     }      /* bunch of other overridden methods throwing not implementedexception */ } } 

now thing i've put breakpoint on every single executable line of code in myroleprovder none hit. have tested breakpoints elsewhere hit debugger not problem. why isn't code in role provided executed? expecting isuserinrole and/or getrolesforuser executed when navigate about-page. wrong? have configured wrong?

full web.config reference

edit: user redirected login page when page clicked. realize due user not authenticated yet. authorization naturally happens after authentication. iisexpress not providing windows identity?

i think type declaration incomplete, should include both full name , assembly name.

type="myproject.code.myroleprovider, myproject" 

you might need set version, culture , publickeytoken if assemblies place in gac

hope helps


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -