Password Dialog Box

This script forces a password dialog box to appear by sending a "401 Not Authorized" status code if the user has not already logged in. To access the page, you must have a valid user account on the server.

This script forces a user to authenticate by using Basic Authentication. If you want to force a user to login using NT Challenge/Response Authentication, then replace the Response.AddHeader statement in the script with the following one:

Response.AddHeader "WWW-Authenticate","NTLM"

          <%
          authUser = TRIM(Request.ServerVariables("AUTH_USER"))
          IF authUser = "" THEN
          Response.Status = "401 Not Authorized"
          Response.AddHeader "WWW-Authenticate", "Basic Realm=""SUPEREXPERT"""
          Response.End
          END IF
          %>
          <html>
          <head><title>Password Please</title></head>
<body> <font face="Arial"size="4" color="blue"><b> Welcome <%=authUser%>! <br>Feel free to view this page. </b></font> </body> </html>

asp 401 Unauthorized NTLM NT Login Via ASP


Back To Top
© 1998 - 2024 psacake.com
Version 7.21 | Advertise on this site