Click to See Complete Forum and Search --> : Getting visitors network username


Danbabe
01-10-2006, 08:48 PM
When logging onto a network, a username is stored and can be pulled up in a batch file - "echo %username%".

In an ASP page, I need to get that network username. I do not wat to have to get them to log in at all, I just need the network username.

I have tried writing a batch file which works and getting ASP to call the batch file and write the response from the .bat:

''''''''''''''''''''''''''''''''
Dim fs, f, user
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile("D:\Home\Default\domain.co.uk\htdocs\BDi2\Username.bat")
set resp = f.Response
set f = nothing
set fs = nothing
''''''''''''''''''''''''''''''''

before I even write the line response.write(resp), the code falls over with .Response not supported.

Does anyone know how I can get the users network username when they logged on to the Windows network?

Thanks yol

Dan

klini
02-03-2006, 10:32 PM
I had the same question. This worked for me:

System.Environment.UserName

Kurt