Hi SirPoonga,
Try out the following code:
Imports System.Security
.........
.........
Dim authUserName As String
Dim aspUserName As String
authUserName = User.Identity.N ame
aspUserName = Principal.Windo wsIdentity.GetC urrent.Name
Label1.Text = "You are: " & authUserName
Label2.Text = "This page runs as: " & aspUserName
and ,
1) Start IIS
2) Expand your server and its default Web site, right-click the "your
project" site, and then click Properties.
3) On the Directory Security tab in the WindowsSite Properties dialog box,
click the Edit button in the "Anonymous access and authentication control"
section.
4) Click to clear the Anonymous access check box, verify that the Integrated
Windows authentication check box is selected, and then click OK.
5) Click OK to close the "your project" Properties dialog box.
6) Switch back to Visual Studio, and then run the project. Confirm that the
page is displayed with the following message:
You are: "Your Windows user name"
This page runs as: DomainOrServer\ ASPNET
For more clarification feel free to touch with me...
Enjoy Programming....
Kombaraj .A
"SirPoonga" wrote:
I have been trying to figure out how to get the user login name of the
user using an asp.net page. This is for an intranet. I got as far as
doing something like this:
Dim wpMain as WindowsPrincipa l
wpMain = new WindowsPrincipa l(WindowsIdenti ty.GetCurrent() )
Label1.Text = wpMain.Identity .Name
However, that will display <COMPUTERNAME>\ ASPNET. I don't need the
ASPNET user, I need the user who is logged into the computer.
Any ideas?