I have implemented my own custom Role manager object. When I run my web app using the visual studio version of IIS, it works fine. I can see the username and I can drill into my Role Manager class and see what it's doing. When I debug the app using IIS 7, HttpContext.Current.User.Identity.Name is blank and it does not use my Role Manager class when determining what roles my user has. I've checked that all my dlls are in the bin directory.
I'm guessing that the problem is on IIS 7. What do I need to configure on IIS 开发者_开发知识库7 to make this work and to make it use my Role manager?
Here is a snippet of the web.config that sets the role manager.
<membership>
<providers>
<clear />
</providers>
</membership>
<roleManager defaultProvider="HyperionRoleProvider" enabled="true">
<providers>
<clear />
<add name="HyperionRoleProvider" type="Census.BUD.Common.HyperionRoleProvider" applicationName="/" />
</providers>
</roleManager>
From:
http://learn.iis.net/page.aspx/528/how-to-use-the-sample-read-only-xml-membership-and-role-providers-with-iis-70/
"These samples are excellent for use with IIS 7.0 for demonstration or test Web sites, but they don't work as-written with IIS 7.0 because of the way that IIS 7.0's security is designed. The original instructions allowed you to deploy the sample membership/role providers into the App_Code folder of your Web site, but IIS 7.0 requires that providers are registered in the Global Assembly Cache (GAC) before they can be deployed. With that in mind, the following steps will walk you through compiling and deploying the read-only XML providers on a development system."
Make sure your assembly is in the GAC
精彩评论