Solved

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

Posted on 1998-11-30
6
995 Views
Last Modified: 2012-06-22
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
Comment
Question by:rick101396
6 Comments
 

Author Comment

by:rick101396
ID: 1840107
Edited text of question
0
 
LVL 10

Expert Comment

by:MasseyM
ID: 1840108
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
 
LVL 28

Expert Comment

by:sybe
ID: 1840109
You can force a login on NT by removing the NT-rights for IUSR_machinename on the directories/files.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:rick101396
ID: 1840110
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
 
LVL 11

Accepted Solution

by:
mouatts earned 50 total points
ID: 1840111
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
 

Author Comment

by:rick101396
ID: 1840112
Thanks,

I think I could try to understand it from here.


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now