473,289 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

Get Windows User Name

Hi

For some time now I have been looking for some client side script to
get the windows logon id.

My asp.net application is running across three domains, so windows
authentication is no use to me. In client / server applications it is
simple to retrive the windows user id of the client to save them typing
it in every time. I wanted to replicate this functionality in a web
application.

This script will only work on PC's running Windows and IE, but thats
all we are running, so that's fine. 'Initialize and script ActiveX
controls not marked as safe' needs to be enabled in IE for this to
work.

Hopefully someone will find this useful.

<script language = "vbscript">
Dim Shell
set shell = createobject("wscript.shell")
set env = shell.environment("process")
document.form1.strUserName.value = env("username")
</script>

Cheers

Jared

May 16 '06 #1
1 1724
Jared,

document.form1.strUserName.value = env("username") did not work for me

But

document.all.form1.strUserName.value = env("username") did work

Thanks for the script

SA
"Jared" <ja***********@gmail.com> wrote in message
news:11*********************@i40g2000cwc.googlegro ups.com...
Hi

For some time now I have been looking for some client side script to
get the windows logon id.

My asp.net application is running across three domains, so windows
authentication is no use to me. In client / server applications it is
simple to retrive the windows user id of the client to save them typing
it in every time. I wanted to replicate this functionality in a web
application.

This script will only work on PC's running Windows and IE, but thats
all we are running, so that's fine. 'Initialize and script ActiveX
controls not marked as safe' needs to be enabled in IE for this to
work.

Hopefully someone will find this useful.

<script language = "vbscript">
Dim Shell
set shell = createobject("wscript.shell")
set env = shell.environment("process")
document.form1.strUserName.value = env("username")
</script>

Cheers

Jared

May 16 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bob Everland | last post by:
I have an application that is ISAPI and the only way to secure it is through NT permissions. I need to have a way to login to windows authentication so that when I get to the ISAPI application no...
3
by: Steven Fox | last post by:
============================================================ About DB2 Administration Tools Environment ============================================================ DB2 administration tools level:...
5
by: pberna | last post by:
Dear all, I built a Web Form application to start and stop a Windows Service remotely. I successful tested the application on Windows 2000 server + IIS. I must include the ASPNET user to the...
9
by: Alex | last post by:
Get the Name and Phone Number of the Current Windows User in a .NET Application I am writing a simple .NET (C#) application. It needs to "automatic" get the Name (last, first) and phone number...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.