I have run into a strange problem with Virtual Roles recently, when using the built-in web server in Visual Studio. Not sure exactly when problem started, but it worked previously. I'm using EPiServer.CMS.Core 7.14.0 and here's what goes wrong:
When using IPrincipal.IsInRole("myVirtualRole"), in a controller for instance, it always returns false, even though the user actually is part of that role.
When I use EPiServer's VirtualRoles.IsPrincipalInVirtualRole(...) for the same role I can see that my role gets invoked and all works. I have verified that my EPiServerFramework.config has the "replacePrincipal" flag set to true (I even checked at runtime that VirtualRoles.IsReplacePrincipal evaluates to true). I have found that the original principal object never gets replaced by the VirtualRolePrincipal wrapper, hence the virtual roles checks always evaluates to false.
Why is the wrapper not kicking in? All this works fine when running the same web application with a local IIS webserver. Any ideas on what's going on here?
I have run into a strange problem with Virtual Roles recently, when using the built-in web server in Visual Studio. Not sure exactly when problem started, but it worked previously. I'm using EPiServer.CMS.Core 7.14.0 and here's what goes wrong:
When using IPrincipal.IsInRole("myVirtualRole"), in a controller for instance, it always returns false, even though the user actually is part of that role.
When I use EPiServer's VirtualRoles.IsPrincipalInVirtualRole(...) for the same role I can see that my role gets invoked and all works. I have verified that my EPiServerFramework.config has the "replacePrincipal" flag set to true (I even checked at runtime that VirtualRoles.IsReplacePrincipal evaluates to true). I have found that the original principal object never gets replaced by the VirtualRolePrincipal wrapper, hence the virtual roles checks always evaluates to false.
Why is the wrapper not kicking in? All this works fine when running the same web application with a local IIS webserver. Any ideas on what's going on here?