The code is as follows:
<SCRIPT TYPE="text/VBScript">
<!--
Dim objNet
On Error Resume Next
Set objNet = CreateObject("WScript.NetWork"
Dim strInfo
strInfo = "UserName is " & objNet.UserName & vbCRLF & _
"ComputerName is " & objNet.ComputerName & vbCRLF & _
"DomainName is " & objNet.UserDomain
MsgBox strInfo
//-->
</SCRIPT>
The short answer is:
request.servervariables("LOGON_USER"
If you put the following on an ASP page you will get a list of all variables and their values:
<h2>Request Server Variables List</h2>
<%
Dim V
response.Write "<Table>"
For Each V in Request.ServerVariables
Response.Write "<TR><TD VAlign='top'><b>" & V & "</b></TD><TD VAlign='top'>" & Request.ServerVariables(V) & "</Font></TD></TR>"
Next
Response.Write "</Table>"
Hi DJS2,
I have put the code as you suggested into a asp file but it doesn't work. I just get the heading Request Server Variables List on the screen. Do I have to add anything else to the file?
I assume that your web server is configured for ASP?
I'm using IIS5 (it also works on IIS4) and the code is hand-written in Front Page 2000. It is a standard ASP page written in VBScript. I use it all of the time to test connections.
<h2>Request Server Variables List</h2>
<%
Dim V
response.Write "<Table>"
For Each V in Request.ServerVariables
Response.Write "<TR><TD VAlign='top'><b>" & V & "</b></TD><TD VAlign='top'>" & Request.ServerVariables(V) & "</Font></TD></TR>"
Next
Response.Write "</Table>"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.