Solved

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

Posted on 1998-11-30
6
1,003 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

688 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