Advertisement
ASP_Volume2 Internet/ HTML #31155

IIS authentication

this code provides a username/password of username/domain to be used on MS IIS to authenticate users. This code don't ivolve any authentication algorythm - it uses basic or Windows authentication made by IIS server. I didn't saw any such code here. This code is only an example, but you can modify it as you wish.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
<%
' if you will uncomment these lines, and open an
' ASP file in your browser, you will see ALL
' strings and parameters, IIS server is passing
' to ASP script - as well as ASP session ID
' and other usefull stuff like client/server IP
'
' ccountst.ServerVariables.Count
' for i=1 to ccount
' stri=Request.ServerVariables.Item(i)
' Response.Write(I & "*" & stri & " <HR>****")
' next
 stri=Request.ServerVariables.Item(7)
 auth=Request.ServerVariables.Item(6)
  If LCase(Left(Auth, 9)) = "negotiate" Then
   Pos = InStr(stri, "\")
   If Pos > 1 Then
   LOGON_Domain = Left(stri, Pos - 1)
   LOGON_User = Mid(stri, Pos + 1)
   End If
   Response.Write("User Domain: " & logon_domain & "<br>")
  end if
  If LCase(Left(Auth, 4)) = "ntlm" Then
   Pos = InStr(stri, "\")
   If Pos > 1 Then
   LOGON_Domain = Left(stri, Pos - 1)
   LOGON_User = Mid(stri, Pos + 1)
   End If
   Response.Write("User Domain: " & logon_domain & "<br>")
  end if
  If LCase(Left(Auth, 5)) = "basic" Then
   Pos = InStr(stri, ":")
   If Pos > 1 Then
   LOGON_User = Mid(stri, Pos + 1)
   End If
   If Pos = 0 Then
   LOGON_User = stri
   End If
   logon_password=Request.ServerVariables.Item(5)
   Response.Write("User Domain: [default] (specified in IIS Admin).<br>")
  end if
 Response.Write("User Name: " & logon_User & "<br>")
  If LCase(Left(Auth, 5)) = "basic" Then
   Response.Write("User Password: " & logon_password & "<br>")
  end if
  If LCase(Left(Auth, 9)) = "negotiate" Then
   Response.Write("User Password: [Windows authenticated a user] <br>")
  end if
  If LCase(Left(Auth, 4)) = "ntlm" Then
   Response.Write("User Password: [Windows authenticated a user] <br>")
  end if
%>
Original Comments (3)
Recovered from Wayback Machine