Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Variables

Status
Not open for further replies.

JezBullen

Programmer
Dec 11, 2001
23
GB
Hi, hope someone can help

I need to take the USERNAME and a few other details from Environment Variables. The code below works for some of the variables, but not others, like USERNAME, LOGONSERVER and COMPUTERNUMBER - do I have to do something different to get this to work?

Thanks in advance,
Jez

<% username= request.servervariables(&quot;windir&quot;) %>

<html><body>
<%Response.Write(username)%>
</body></html
 
The security credentials are held in an HTTP header called AUTH_USER, there are similar ones for the other pieces of information that you want but off the top of my head I can't remember them.

The documentation lists all of them though.

Neil
 
Thanks, I can get variables such as HTTP_USER_AGENT and REMOTE_ADDR to work, but still can't get the User name.

Sorry to be a pain but I'm new to this and trying to teach myself ASP - where do I find the documentation relating to the Environment Variables?

Thanks again in advance
Jez
 
request.servervariables(&quot;AUTH_USER&quot;) returns domain\username.

Whatever editor you are using should come with the documentation if it is a proper ASP editor.

The MSDN library and the macromedia dreamweaver documentation have them in, failing search the internet for HTTP_HEADERS.

Neil
 
Thanks for your help, I was getting it right but for some reason some of the Server Variables return nothing(and it would be the ones I want)

Must be something to do with my server/client settings

I'll have to try another method

Cheers
 
Try this in a ASP page, so you can see all the Servervariables
<table cellpadding=&quot;1&quot; border=&quot;0&quot; cellspacing=&quot;0&quot;>
<%
For Each strItem in Request.ServerVariables
If strBGColour = &quot;FFFFFF&quot; Then
strBGColour = &quot;CCCCCC&quot;
Else
strBGColour = &quot;FFFFFF&quot;
End If
%>
<tr bgcolor=&quot;#<% =strBgColour %>&quot;><td width=&quot;30%&quot; valign=&quot;top&quot;><p><% =strItem %></p></td><td valign=&quot;top&quot;><p><% =Request.ServerVariables(strItem) %></p></td></tr>
<%
Next
%>
</table>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top