Help with IIS please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coderthebarbarian
    New Member
    • Mar 2007
    • 1

    #1

    Help with IIS please

    Using VB 2005. I've got to be able to connect to a server app in both a domain and a workgroup scenario using IIS. The domain code passes Windows Authentication. The workgroup code requires the user to enter their username and password. Checking "local impersonation" in the ASP.NET Configuration Settings lets the code for domain access to work, but not the workgroup. Unchecking "local impersonation" breaks the domain code. Anybody have code for both. Thanks.

    Here's the two functions:
    'domain
    Public Function GetUsersGroups( ByVal ServerName As String, ByVal DomainName As String, ByVal UserName As String) As String()
    Dim iCount As Integer = 0
    Dim szGroups() As String = Nothing
    Dim Computer
    Dim oGroup
    Dim Group
    Dim groupnames As String = ""
    Dim filter As System.Object() = {"group"}
    Computer = GetObject("WinN T://" & ServerName)
    Computer.Filter = filter
    For Each Group In Computer
    oGroup = GetObject("WinN T://" & ServerName & "/" & Group.name & ",group")
    If oGroup.IsMember (GetObject("Win NT://" & DomainName & "/" & UserName & ",user").adspat h) Then
    ReDim Preserve szGroups(iCount )
    szGroups(iCount ) = Group.name
    iCount += 1
    End If
    Next
    Return szGroups
    End Function

    'workgroup
    Public Function AuthenticateLog in(ByVal Workgroup As String, ByVal username As String, ByVal password As String) As Boolean
    Try
    Dim objNS = GetObject("WinN T:")
    Dim filter As System.Object() = {"groups"}
    Dim objContainer = objNS.OpenDSObj ect("WinNT://" & Workgroup, username, password, 1)
    objContainer.fi lter = filter
    For Each objUser As Object In objContainer

    'Console.WriteL ine(objUser.nam e)

    Next
    Return True
    Catch Err As Exception
    Return False
    End Try
    End Function
Working...