Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Please help me. I am working around one week for configure the application, i feel very bad.

All application developed in 2003(framework 1.1.4322) with Active Directory Authentication.All apllication working in 2003 R2 server.but now i trying to configured in windows server 2008 r2 server(IIS 7.5). Active Directory Application is not working. i got error while authenticate with active directory. when comment this authentication it's working.

But i have one classic asp application with Active Directory it's working fine the same server.

Please help on this.

Please Have look below Highlighted in Bold, when i run his method application i got error because method returns nothing that's why i got index out range error.If comment the clsDE.GetLDAPUserAsArrayList method means application working
My Actual Code,

VB
xUser =Request.ServerVariables("LOGON_USER")

Public Function getLdapId(ByVal xUser As String) As DataRow 
Dim adpt As New SqlDataAdapter

Dim objDS As New DataSet 
Dim strSQL, strName As String

Dim clsDE As New clsDirectoryEntry 
Dim tbUser As New DataTable

Dim tbP As New DataTable 
Dim tbPM As New DataTable

Dim alReturn As New ArrayList 
Dim intLadpId As Integer

Dim i, j As Integer

Dim aLogonInfo As Array 
Dim strConnectionString, logonuser, sDomain, sUser, sSQL As String

aLogonInfo = xUser.Split("\")

Try

 

Select Case UBound(aLogonInfo)Case 0 
sDomain = ""

sUser = aLogonInfo(0)

Case 1 
sDomain = aLogonInfo(0)

sUser = aLogonInfo(1)

End Select

Catch ex As Exception 
Throw ex

End Try

If sDomain = "" And sUser = "" Then

Return Nothing

End If

'clsDE.LDAP_Login_Path = System.Configuration.ConfigurationSettings.AppSettings("LDAP_Login_Path")'Commented for B&K spin

If (sDomain = "AM" Or sDomain = "am") Then ' added for B&K spin

clsDE.LDAP_Login_Path = System.Configuration.ConfigurationSettings.AppSettings("LDAP_Login_Path")

End If clsDE.LDAP_Login_UserName = System.Configuration.ConfigurationSettings.AppSettings("LDAP_Login_UserName") 
clsDE.LDAP_Login_PWD = System.Configuration.ConfigurationSettings.AppSettings("LDAP_Login_PWD")

'(Please Have look below Highlighted in Bold, when i run his method application i got error because method returns nothing that's why i got index out 'range error.If comment the clsDE.GetLDAPUserAsArrayList method means application working)

alReturn = clsDE.GetLDAPUserAsArrayList(clsDE.LDAP_Login_UserName, clsDE.LDAP_Login_PWD, "Network Domain\User ID", sUser, sDomain, clsDE.LDAP_Login_Path) 

If Not alReturn Is Nothing Then

If (alReturn.Count > 0) Then

'tbPM.Columns.Add(New DataColumn("LDAP_ID", GetType(Integer))) 'Commented for B&K SPINOFF

tbPM.Columns.Add(New DataColumn("LDAP_ID", GetType(String))) 'Added for B&K SPINOFF

clsDE = alReturn(0)

Dim objRow As DataRow = tbPM.NewRow 
objRow("LDAP_ID") = clsDE.LDAP_ID

tbPM.Rows.Add(objRow)

Return tbPM.Rows(0) 
Else

Return Nothing

End If

Else

Return Nothing

End If

End Function
Posted
Updated 11-May-12 3:36am
v3

1 solution

I have no idea what any of that code is, you don't need it for .Net 'Windows Authentication' anyway.

1) In your virtual directory, make sure that the application is set to the correct authentication type
http://msdn.microsoft.com/en-us/library/bb763173.aspx[^]

2) In your web.config, set your authentication mode to 'Windows'
http://msdn.microsoft.com/en-us/library/ff647405.aspx[^]

3) In your web.config, setup who you want to allow access...either by allowing groups of users or specific domain users

e.g.

XML
<system.web>
  <authorization>
    <allow roles="Customer,Employee,Administrator,eBay Merchant"/>
    <allow users="SomeDomain\d.morley"/>    
    <deny users="*"/>
  </authorization>
</system.web>



Basically though, you should be able to get this up and running without a single line of code...it's all config settings
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900