2

I have created an Intranet application for storing customer related details. The application also stores Windows Logon nID of the person who submitted the form (Envionment.Username). Everything looks and works good in Localhost. The form got deployed in IIS and now Environment.Uusername returns a value from application pool inside IIS. We have set an identity value in IIS application pool which has access to the database and that value is getting returned for Environment.Username.

I tried with System.Web.HttpContext.Current.User.Identity.Name but it returns a empty value.

WindowsAuthentication and AnonymousAuthenication are set to ENABLED in IIS.

Any leads on this would be of great help.

Thanks in advance

awh112
  • 1,466
  • 4
  • 22
  • 34
Avinesh
  • 21
  • 5
  • Did you try `HttpContext.Current.User.Identity.Name`, This should work if you are using windows authentication. – Kurubaran Jun 13 '18 at 18:10
  • Have you tried disabling `Anonymous Authentication`? From what I remember, the authentication models work in a hierarchy with the simplest one first (Anonymous) and that will also work as there is nothing to gather/authenticate. Also, you *may* need to enable `Impersonation` to get the Logged On User credentials when accessing the database – JayV Jun 13 '18 at 20:44
  • https://stackoverflow.com/questions/1843271/whats-the-difference-between-httpcontext-current-user-and-thread-currentprincip/1843367#1843367 You should never call the methods above, but use what ASP.NET framework offers on pages or controllers natively. – Lex Li Jun 13 '18 at 21:06
  • Thanks for your replies. @JayV i tried to set Anonymous Authentication disabled, but i am getting HTTP ERROR 404.15 - NOT FOUND – Avinesh Jun 14 '18 at 03:10
  • Can anyone please tell me , why i am unable to run the application locally by setting Anonymous Authentication in disabled state? – Avinesh Jun 14 '18 at 03:17

0 Answers0