Active Server Pages Programming (ASP)/error to finfd username
Expert: Srini Nagarajan - 2/13/2008
QuestionWhy ????
If i use sUserName = "OI24683" the script work fine
instead if i use
sUserName = Request.ServerVariables("LOGON_USER")
to retrive the username on NT AD the scrpit go in error in:
Set oUser = GetObject("WinNT://" & sDomain & "/" & sUserName & ",user")
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nuova pagina 1</title>
</head>
<body>
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim sUserName
Dim sDomain
sUserName = Request.ServerVariables("LOGON_USER")
sDomain = "DIP"
'sUserName = "OI24683"
Set oUser = GetObject("WinNT://" & sDomain & "/" & sUserName & ",user")
For Each oGroup In oUser.Groups
Select Case(oGroup.Name)
Case "InpdapNAXX"
'Response.write("InpdapNAXX")
Response.Redirect("./default.html")
Case "Group B"
'response.write("Yay")
Response.Redirect("A.asp")
Case "Group C"
'response.Redirect("Z.asp")
Case "Group D"
'Response.redirect("Y.asp")
End Select
Next
%>
</body>
</html>
</form>
AnswerHi
If you use Request.ServerVariables("LOGON_USER") there could be 2 thing you need to look for
1. The LOGON_USER variable is not populated if you use the Allow Anonymous security to access the ASP page.
2. In order for the LOGON_USER variable to be populated, the user must be authenticated using either Basic or NT Challenge/Response security.
Hope this helps!!
-Srini