Click to See Complete Forum and Search --> : Get User's Windows Login


hawgwild
July 10th, 2002, 12:44 PM
I am building a web page for our intranet that is running on a Windows 2000 system. I want to retrieve the Windows login of the user connected to my web page. Can anyone tell me how to do this?

I am writing this using Visual Studio .NET with VB.NET.

Thanks in advance.

CPCericola
July 10th, 2002, 03:34 PM
You may need to use Integrated Windows Authentication on the website itself from the IIS admin tool. In the actual code, you just need to reference Page.User property. The authenticated username can be found by doing this:


Response.Write(Page.User.Identity.Name);


Best of luck!

goddess_spanky
July 10th, 2002, 03:57 PM
I believe the only way to get the NT info you are looking for is to turn on the "integrated authentication" option in IIS.
Unless you have a COM object that can do the same thing...

The method I use to pull the users' NT info is

Request.ServerVariables("REMOTE_USER")

I think if you have annonymous browsing enabled, all you are going to get is "IUSER_MYSERVERNAME" as the NT account info.

You will get the domain name they are logged in to as well as their username.

I don't think this technique is different when using .NET, but lemme know if it is.