Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1011
  • Last Modified:

request.ServerVariables("LOGON_USER") doesn't work

Hi

I tried using the command :

<%=request.ServerVariables("LOGON_USER")%>

in my script but it only give me an empty string.  Is there some variable that I must declare or create in order to display the server  environment variable?  

I appreciate any help to get the script to work. Thank you.

0
rick101396
Asked:
rick101396
1 Solution
 
rick101396Author Commented:
Edited text of question
0
 
MasseyMCommented:
To use the LOGON_USER, the user must actually log in to the NT server.  Therefore you would have to have a profile set up for that user.  the other variables will work fine.

ie:
<%=Request.ServerVariables("HTTp_REMOTEHOST") %>


0
 
sybeCommented:
You can force a login on NT by removing the NT-rights for IUSR_machinename on the directories/files.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
rick101396Author Commented:
MasseyM:

The code that I tried to execute didn't give me the user names.  What I want to do is be able to get the logon user name and redirect them different web page if they proper access.  

<html> <head><title>New Page </title></head>
<body>
<p>User Name: <%=request.ServerVariables("LOGON_USER")%> </p>
<p>Remote User: <%=request.ServerVariables("HTTP_REMOTEHOST")%> </p>
</body>
</html>

I tried view the page with the codes (above) on both my computer and on another computer on the Intranet, but I am not getting anything for the script except empty strings.  What I am running on my workstation is IIS 4 with ASP.  Could it be because I am missing something?

Thanks.
0
 
mouattsCommented:
Firstly HTTP_REMOTEHOST should read REMOTE_HOST.

But I'm not sure that this is what you want as it does not always contain the name of the remote computer as it can contain the IP address of this machine.

As has been said before the LOGON_USER is not normally established unless a logon has occurred.

To get a better idea of what variables are being set in your particular case try running the script below.

<HTML>
<HEAD>
<TITLE>HTTP Variables</TITLE>
</HEAD>
<BODY><H1>HTTP SERVER VARIABLES></H1>
<TABLE>
<TR><TD><B>Server Variable</B></TD><TD><B>Value</B></TD></TR>
<% For Each name In Request.ServerVariables %>
<TR><TD> <%= name %> </TD><TD>  <%= Request.ServerVariables(name) %> </TD></TR>
<% Next %>
</TABLE>

 
</BODY></HTML>

Steve
0
 
rick101396Author Commented:
Thanks,

I think I could try to understand it from here.


0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now