I have a MVC 5 project using ASP.NET Identity (Invidual user account). As Database ORM I am using Entity framework 6 and IoC is taken care by Ninject.
Solution structure is following
[Authorize]
attribute works fine and I have to login to access tha annotated action, but when I set [Authorize(Roles = "Admin")]
I get
Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
I created my on CustomAuthorize attibute which was basically a copy of Authorize and noticed that the
httpcontext in protected virtual bool AuthorizeCore(HttpContextBase httpContext)
User.ProviderName is "AspNetSqlRoleProvider".
So I added Rolemanages clear to my web.config. This resulted in
Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Default Role Provider could not be found.
Source Error:
Line 53: --> Line 54: Line 55: Line 56: Line 57:
Source File: ...myproject\WebUI\web.config Line: 55
So whats the deal here? How can I set the Default Role Provider to use ASP.NET Identity?
So right after I posted the question I figured the answer. I had to add
<system.webServer> <modules> ... <remove name="RoleManager" /> </modules> </system.webServer>
That did it. But there still is a question of why?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With