Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

VirtualRoles not working in Visual Studio web server

Vote:
 

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?

#114696
Dec 18, 2014 14:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.