I have a problem with ("auth_user") in asp,I try to use windows
username and password in asp page for limitation user access to pages,
but this server variable returns empty string, can you help me ,I
appreciate it.
Hi nikou_70,
You have to either deactivate the "windows logon" checkbox in the IIS
Server configuration (under Security) so that only "anonymous" and
"basic authentication" is active
or if you are using a Active Directory Domain, you can get the user
information with the ADSystemInfo Object:
Example Code:
<%
Dim oAD,oUser,strUserDN,strUserName,strFullName
Set oAD = Server.CreateObject("ADSystemInfo")
On Error Resume Next 'disable Error Checking
strUserDN = oAD.UserName
Set oAD = Nothing
If Err = 0 Then 'no error occured
On Error Goto 0 'enable Error Checking
Set oUser = GetObject("LDAP://" & strUserDN)
strUserName = oUser.SamAccountName
strFullName = oUser.FullName
Set oUser = Nothing
Response.Write "You are User [" & strFullName & _
"] with Username [" & strUserName & "]."
Else
On Error Goto 0 'enable Error Checking
Response.Write "ERROR: You are no Active Directory User!"
End If
%>
HTH
Gottfried