1

I am trying to use 'MsgBox(User.Identity.Name)' to show the Current Windows User in a MessageBox. The MessageBox that appears shows "App_Web_1gu0lxe5" as the Title and Message is Empty. In other words I am not able to get the Current Windows User in the Output.

I am using Windows 8.1 Enterprise, 64-bit Operating System, Microsoft Visual Studio 2012, Visual Basic is the Programming Language and I am trying to develop a Web Application.

When I am running the same code on a Machine running "Windows 7 Enterprise, Service Pack 1, 64-bit Operating System" the code produces the desired result.

Any Idea what could be the cause of the Problem?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
TheDProgrammer
  • 95
  • 2
  • 4
  • 13

1 Answers1

2

You probably had Anonymous Authentication on as well as Windows Authentication. Turn off Anonymous off.

So,

<system.web>
    <authentication mode="Windows" />
</system.web>

In IIS config for the app, look in Authentication tab

Set Anonymous Authentication to Disabled and Set Windows Authentication to Enabled

This should work and the Identity.UserName should now show up properly.

Avijit
  • 1,219
  • 2
  • 15
  • 28