I'm using a custom IIdentity
and IPrincipal
in my ASP.NET MVC
application via EF 4.3
as expalined here (and follow accepted answer's solution). Also, I have a custom RoleProvider
. In local (using IIS Express
), it works currectly. But now, when I upload the application on a real host, it seems all users are in "admin"
role! e.g. I create a user that is not in role "admin"
, but it can access to all protected pages (that need "admin"
role). e.g. Role.IsUserInRole
always returns true
. Have you any idea please? Can you help me? Is there any setting that I should to do in IIS
?
相关问题
- Entity Framework throws exception - Network Relate
- Slow loading first page - ASP.NET MVC
- How to do an inline style with asp.net mvc 3 razor
- How to access the System.ComponentModel.DataAnnota
- Validation Attribute get triggered two times
相关文章
- “Dynamic operations can only be performed in homog
- Change color of bars depending on value in Highcha
- How to get server path of physical path ?
- How to find the exceptions / errors when TryUpdate
- ASP.Net MVC 3: optgroup support in Html.DropDownLi
- A circular reference was detected while serializin
- AccessViolationException was unhandled
- How to hide miniprofiler?
If you want to keep using the default RoleManager, it gets difficult. I tried creating my own RoleManager by deriving from the default, without any luck. After 2 days trying several things, I ended up creating some extension methods for RolePrincipal:
Created a new WebViewPage class:
Modified the web.config in the views folder:
And all my Controllers derive from my BaseController:
Downside is that the methods query my database everytime they get called. I'm using MVC 4 btw
Hope this helps anyone
I explain that solution and it works for me. I don't now, may be you should rollback to the
AuthenticateRequest
event.If you want to try this way, you have to removeRoleManagerModule
completely from your project. Try this and let me know if works or nop: