I have finished testing my first asp.net appliation and I am now trying to deploy it to the server so our users can access the system.

Some of the code accesses active directory and these seem to be the areas that error out when I test the application on the server. Everything works fine on my local machine when I debug and test.

The first place the system errors/does nothing is the main menu screen. If the user is not part of the designated group a link button is hidden.

Here is the code:
Code:
Imports System.Data.SqlClient
Imports ActiveDs

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Cnn As New SqlConnection([connection string])
        Dim cmdName As New SqlCommand()
        Dim rdrName As SqlDataReader
        Dim ADuser As IADsUser
        Dim ADGrp As IADsGroup

        Try
            If Not IsPostBack Then
                With cmdName
                    .CommandType = CommandType.StoredProcedure
                    .CommandText = "sp_FullName_s"
                    .Parameters.Clear()
                    .Parameters.Add("@Name", SqlDbType.Char, 8).Value = Right(Trim(User.Identity.Name), Len(User.Identity.Name) - InStr(User.Identity.Name, "\"))
                    .CommandTimeout = 99
                    .Connection = Cnn
                End With

                Cnn.Open()
                rdrName = cmdName.ExecuteReader
                While rdrName.Read
                    Response.Write(Trim(rdrName("DisplayName")) & " is currently logged into the Dub Request System.")
                    ADuser = GetObject(CStr(Trim(rdrName("ADsPath"))))
                    For Each ADGrp In ADuser.Groups
                        If Trim(ADGrp.Name) = "CN=Dub Manager" And ADuser.AccountDisabled = False Then
                            lnkDelegate.Visible = True
                            Exit For
                        Else
                            lnkDelegate.Visible = False
                        End If
                    Next
                End While
                rdrName.Close()
                Cnn.Close()
            End If
        Catch
            Response.Redirect("errmsg.aspx?err=100")
        Finally
            Cnn.Dispose()
            cmdName.Dispose()
            Cnn = Nothing
            cmdName = Nothing
        End Try
    End Sub

End Class
When I log in the user's name is displayed correctly, but the logic to determine whether the button should be visible or not is ignored. The user I am testing with is not part of the group that should allow it to be visible.

The second place I experience this error is when I populate a check box list with users from a group in active directory:
Code:
Imports System.Data.SqlClient
Imports ActiveDs

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Cnn As New SqlConnection([connection string])
        Dim cmdEmail As New SqlCommand()
        Dim rdrEmail As SqlDataReader
        Dim ADGrp As IADsGroup
        Dim ADUsr As IADsUser
        Dim Emails As New ArrayList()

        WOID = CInt(Trim(Request.QueryString("ID")))

        If Not IsPostBack Then
            Try
                ADGrp = GetObject("LDAP://W2KRoot/CN=All Staff,CN=Users,DC=CORP,DC=WITF,DC=ORG")
                For Each ADUsr In ADGrp.Members
                    If ADUsr.AccountDisabled = False Then
                        Emails.Add(ADUsr.FullName)
                    End If
                Next
                Emails.Sort()
                cblEmail.DataSource = Emails
                cblEmail.DataBind()
                With cmdEmail
                    .CommandType = CommandType.StoredProcedure
                    .CommandText = "sp_EmailTo_s"
                    .Parameters.Clear()
                    .Parameters.Add("@WO", SqlDbType.Int).Value = WOID
                    .CommandTimeout = 99
                    .Connection = Cnn
                End With

                Cnn.Open()
                rdrEmail = cmdEmail.ExecuteReader
                While rdrEmail.Read
                    Try
                        cblEmail.Items.Item(cblEmail.Items.IndexOf(cblEmail.Items.FindByValue(rdrEmail.Item("DisplayName")))).Selected = True
                    Catch
                    End Try
                End While
                rdrEmail.Close()
                Cnn.Close()
            Catch
                Response.Redirect("ErrMsg.aspx?Err=110")
            Finally
                Cnn.Dispose()
                cmdEmail.Dispose()
                Cnn = Nothing
                cmdEmail = Nothing
            End Try
        End If
    End Sub
When testing I commented out the try/catch statement and got this error.
Code:
Server Error in '/DubRequest_Test' Application.
--------------------------------------------------------------------------------
Exception from HRESULT: 0x8000500C. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x8000500C.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 

[COMException (0x8000500c): Exception from HRESULT: 0x8000500C.]
   ActiveDs.IADsUser.get_AccountDisabled() +0
   DubRequest.EmailListing.Page_Load(Object sender, EventArgs e) +310
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +29
   System.Web.UI.Page.ProcessRequestMain() +724
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.288; ASP.NET Version:1.0.3705.288
Any ideas what's going on? I think it has something to do with the C:/Windows/System32/activeds.tlb file.

any help would be greatly appreciated.