[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Why Request.ServerVariables("LOGON_NAME") is empty!

Hi, I authenticated our web page through NTLM but when I try to retrieve Request.ServerVariables("LOGON_NAME") it is empty, IIS is confugured correctly and anonymous login is disabled.
Did I miss something? Why Request.ServerVariables("LOGON_NAME") is empty!

Please help.
0
Abdu_Allah
Asked:
Abdu_Allah
  • 6
  • 4
3 Solutions
 
WMIFCommented:
if you put this code onto a page within that directory, does it show then?

<%
for each item in request.ServerVariables
    response.Write "<b>" & item & "</b> - " & request.ServerVariables(item) & "<br>"
next
%>

you should see the same value for "remote_user" also.
0
 
darkeryuCommented:
Hi:

you can use:
userName = Request.ServerVariables("logon_user")

but if your server is a member of domain your userName maybe include the domain name (like domain/userName)

thanks
0
 
Abdu_AllahAuthor Commented:
WMF, this is very strange, Your code successfully print out the LOGON_NAME user! but why my code did not!

Here is my code:
DomainAndUser = Request.ServerVariables("LOGON_NAME")
response.write DomainAndUser

It does not print anything!!
0
Independent Software Vendors: 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!

 
Abdu_AllahAuthor Commented:
Here is some of what your code printed out:
.
.
.
LOGON_USER - administrator
REMOTE_ADDR - 127.0.0.1
REMOTE_HOST - 127.0.0.1
REMOTE_USER - administrator
.
.
.
0
 
WMIFCommented:
that is very interesting!  lets try directly writing on _your_ page without assigning the value to a variable.

so your code:
DomainAndUser = Request.ServerVariables("LOGON_NAME")
response.write DomainAndUser

change to:
response.write Request.ServerVariables("LOGON_NAME") & "<br>"
DomainAndUser = Request.ServerVariables("LOGON_NAME")
response.write DomainAndUser
0
 
Abdu_AllahAuthor Commented:
Actually I found th reason it is with: LOGON_USER and not LOGON_NAME !!
0
 
Abdu_AllahAuthor Commented:
Why there is no LOGON_NAME variable here! my server is Win 2003 server!
0
 
WMIFCommented:
good catch.  i dont think there is name on 2000 either.
0
 
Abdu_AllahAuthor Commented:
Actually darkeryu wrote it but I did not see it.

Well, I need to retrieve domain name if the user did not enter it in the user name edit box in this format(Domain\user name) I cannot retrieve it...how can I force the users to enter the format: Domain\user name?
0
 
WMIFCommented:
they should be forced to enter that by the authentication engine in iis.  are you using basic or integrated auth?
0
 
Abdu_AllahAuthor Commented:
I am using basic, I have changed to integrated auth and it works fine. thank you.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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