0

I have this application where I login by the PC user. I'm using this:

public static bool IsAuthenticated()
{
    if (HttpContext.Current.User.Identity.IsAuthenticated)
    {
        CurrentUser = Factory.Users.List(item => item.Username.ToLower() == cToLower()).FirstOrDefault();
    }

    return CurrentUser != null;
}

Note: .List(), is a method I created to list all database Users (in this case).

Everything works fine. But when I publish my Website on my IIS, HttpContext.Current.User.Identity.Name is returning nothing, no user at all. What is wrong with it? Any suggestion?

etritb
  • 75
  • 3
  • 10
  • have you read this? does this help? http://stackoverflow.com/questions/1056487/httpcontext-current-user-identity-name-is-always-string-empty – Squirrel5853 Sep 23 '13 at 11:51

1 Answers1

0

You have to enable IIS Windows Authentication and Deny Annomyous acces. You can either configure your IIS or update your configuration file as follows,

<configuration>
  <system.web>
    <authentication mode="Windows" />
         <authorization>
             <deny users="?"/>
          </authorization> 
    </system.web> 
</configuration>
Kurubaran
  • 8,696
  • 5
  • 43
  • 65