0

This project authenticates with System.Security.Principal.WindowsIdentity

I had a look at this: Can't get HttpContext.Current.User.Identity to work in my WebMatrix project

        IIdentity WinId = HttpContext.Current.User.Identity;//returns no data
        WindowsIdentity wi = (WindowsIdentity)WinId;

I have disabled anonymous in my Web.config

http://forums.asp.net/t/1901573.aspx?System+web+HttpContext+Current+User+Identity+Name+returns+Empty+string

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

The wierd part is I have another project that uses the same code and has has the same .config but works,

Community
  • 1
  • 1
Jack
  • 526
  • 3
  • 10
  • 30
  • Did you install the Windows authentication role service on IIS? http://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication/providers – Andreas May 09 '14 at 11:33
  • Have you run your application on same domain or different domains? –  May 09 '14 at 11:53
  • Yes It is Enabled, Regardless - same result – Jack May 09 '14 at 11:53

1 Answers1

2

Have you wrote this in your web config ??

<authentication mode="Windows"/>

and please just take a look this

System.Web.HttpContext.Current.User.Identity.Name Vs System.Environment.UserName in ASP.NET

Community
  • 1
  • 1
  • Yes I have, I cant use **System.Environment.UserName** since this is an intranet application – Jack May 09 '14 at 13:23