Reputation: 4517
I have implemented a customer role provider in a C# MVC app.
It doesn't seem to be detecting the Windows user.
This was working fine yesterday.
The config for it looks like this:
<system.web>
<authentication mode="Windows" />
<roleManager defaultProvider="MyRoleProvider" enabled="true">
<providers>
<clear />
<add name="MyRoleProvider" type="CWC_Service_Plan.Security.MyRoleProvider" />
</providers>
</roleManager>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>
However adding a break-point in the code I can see that the User is not being detected.
I must have changed something without realising. What could be causing this?
[Edit]
Role-providers work by picking up the Windows username and then using it to authenticate.
No authentication happens if it can't pick-up the username.
The question is about why the username is not being picked-up, which I appreciate is a big question, so all suggestions are good suggestions.
[/Edit]
Upvotes: 0
Views: 164
Reputation: 11095
Have you disabled Anonymous access?
See Configuring Windows Authentication:
This applies to Visual Studio too, it's a property of the web project (select the web project and press F4):
Upvotes: 1