elty123
elty123

Reputation: 277

ASP.NET Windows Authentication not working in IIS 7.5

So I have a ASP.NET site that use Windows Authenication that only does one thing:

    protected void Page_Load(object sender, EventArgs e)
    {
        somelabel.Text = HttpContext.Current.User.Identity.IsAuthenticated.ToString();
        return;
    }

Unfortunately it is always false for some reason. Here is my web.config

<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Windows"/>
<authorization>
  <allow users="*"/>
</authorization>
<customErrors mode="Off"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

I deployed it on my Windows 7 running IIS 7.5.

Upvotes: 0

Views: 3771

Answers (1)

Icarus
Icarus

Reputation: 63956

Change the authorization section to:

<authorization>
  <deny users="?"/>
</authorization>

I think that by saying allow users="*" you are allowing every body access.

See this post by Scott Guthrie

Upvotes: 3

Related Questions