Search Tools Links Login

IIS Authentication

Posted: 2002-06-01
By: ArchiveBot
Viewed: 66

Filed Under:


No attachments for this post

Requests users to login to website with NT Account.

Original Author: Lewis E. Moten III


Dim ObjSite
Call Authenticate(ObjSite)
Sub Authenticate(ByRef pObjSite)

Dim lLngInstanceID
Dim lStrMetabasePath
Dim lBlnContinue
Dim lBlnLoginFailure

On Error Resume Next
lLngInstanceID = Request.ServerVariables("INSTANCE_ID")

' Programmers Notes ...
' Metabase Path Key Type
' /LM/W3SVC IIsWebService
' /LM/W3SVC/N IIsWebServer
' /LM/W3SVC/N/ROOT IIsWebVirtualDir
' /LM/W3SVC/N/ROOT/WebVirtualDir IIsWebVirtualDir
' /LM/W3SVC/N/ROOT/WebVirtualDir/WebDirectory IIsWebDirectory
' /LM/W3SVC/N/ROOT/WebVirtualDir/WebDirectory/WebFile IIsWebFile
' N = lLngInstanceID

lStrMetabasePath = Request.ServerVariables("APPL_MD_PATH")
lStrMetabasePath = Replace(lStrMetabasePath, "/LM/", "IIS://LOCALHOST/", 1, vbTextCompare)

Set pObjSite = GetObject(lStrMetabasePath)
If Err = &H800401E4 Or Err = 70 Then
Response.Status = "401 access denied"
BlnContinue = False
BlnLoginFailure = True
If Err = 0 Then
lBlnContinue = True
lBlnContinue = False
lBlnLoginFailure = False
End If
End If

If lBlnLoginFailure Then
Response.Write "Login Failure.
End If
If Not lBlnContinue Then
Response.Write "Can not continue.
End If
End Sub

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.