Reputation: 6715
I'd like to play about with WindowsAuthentication but am seemingly falling down at the first hurdle.
So I created an empty ASP.Net Webforms app and amended the web.config as so:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<httpRuntime/>
<authentication mode="Windows" />
<identity impersonate="true"/>
</system.web>
</configuration>
Fire up the app and on page load check the following for a value:
HttpContext.Current.User.Identity.Name
but it returns an empty string (and also shows that HttpContext.Current.User.Identity.IsAuthenticated
is false).
My expectation was to see my windows account name returned e.g. mydomain\rob
Where am I going wrong?
Upvotes: 1
Views: 2880
Reputation: 3360
In IIS, Windows Authentication won't work while Anonymous Authentication is enabled.
Upvotes: 2