1

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?

2
  • 1
    Using IIS or ASP.NET Development Server? Commented Jun 13, 2013 at 10:09
  • 1
    I was using IIS Express (from VS). Switched to using ASP.Net Dev Server and it works as I expected... Commented Jun 13, 2013 at 10:20

1 Answer 1

2

In IIS, Windows Authentication won't work while Anonymous Authentication is enabled.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.