473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

The server is not operational while accessing LDAP Server

I have created Login.aspx Page On Click of Login Button.I invoke the code as follows
================================================== ====
Dim adPath As String = "LDAP://172.21.1.19" 'Path to your LDAP directory server
Dim adAuth As New Authentication.FormsAuth.LDapAuthentication(adPath )
Try
If (True = adAuth.IsAuthenticated(txtDomain.Text, txtUsername.Text, txtPassword.Text)) Then
Dim groups As String = adAuth.GetGroups()

'Create the ticket, and add the groups.
Dim isCookiePersistent As Boolean = chkPersist.Checked
Dim authTicket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, _
txtUsername.Text, DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent, groups)

'Encrypt the ticket.
Dim encryptedTicket As String = FormsAuthentication.Encrypt(authTicket)

'Create a cookie, and then add the encrypted ticket to the cookie as data.
Dim authCookie As HttpCookie = New HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket)

If (isCookiePersistent = True) Then
authCookie.Expires = authTicket.Expiration
End If
'Add the cookie to the outgoing cookies collection.
Response.Cookies.Add(authCookie)

'You can redirect now.
Response.Redirect(FormsAuthentication.GetRedirectU rl(txtUsername.Text, False))

Else
errorLabel.Text = "Authentication did not succeed. Check user name and password."
End If

Catch ex As Exception
errorLabel.Text = "Error authenticating. " & ex.Message
End Try
End Sub

================================================== ========I have set LDAP Path to my Server IP Address

Now In IsAuthenticated Method I am calling the code as follows

======================================
Dim domainAndUsername As String = domain & "\" & username
'Dim domainAndUserName As String = username
Dim entry As DirectoryEntry = New DirectoryEntry(_path, domainAndUsername, pwd, AuthenticationTypes.Secure)

Try
'Bind to the native AdsObject to force authentication.
Dim obj As Object = entry.NativeObject
Dim search As DirectorySearcher = New DirectorySearcher(entry)

search.Filter = "(SAMAccountName=" & username & ")"
search.PropertiesToLoad.Add("cn")
Dim result As SearchResult = search.FindOne()

If (result Is Nothing) Then
Return False
End If

'Update the new path to the user in the directory.
_path = result.Path
_filterAttribute = CType(result.Properties("cn")(0), String)

Catch ex As Exception
Throw New Exception("Error authenticating user. " & ex.Message)
End Try

Return True


=================================
But on the following line i am getting error called "The server is not operational"

Dim entry As DirectoryEntry = New DirectoryEntry(_path, domainAndUsername, pwd, AuthenticationTypes.Secure)


Any solution on this problem will be appreciated

Thanks in Advance
Mar 13 '07 #1
1 19926
kenobewan
4,871 Expert 4TB
The most common cause of this error is when the server that you are trying to contact is down. Next on the list would be it has a firewall that is blocking you, the path is incorrect so it doesn't exist or binding syntax errors.

Hope that this helps.
Mar 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: jiing | last post by:
<?php $ldapServer="ldap://192.168.1.211"; $ldapPort="389"; $ldapconn=ldap_connect($ldapServer,$ldapPort); $ldaprdn="uid=root, ou=People, dc=aitc, dc=com, dc=tw"; $ldappass="abcd"; ...
0
by: Andy Leszczynski | last post by:
Hi, I am looking for a Python barebones for a simple LDAP server project. It does not have to be Twisted based, but it would be wonderful if it is. I need a very simple server which is listening...
1
by: mel finney | last post by:
Hi I am trying to access a LDAP server with ASP with no sucess. I can do it with ColdFusion but not ASP. All the examples I have seen so far do not use passwords or userid's. My LDAP server...
1
by: Pixaar | last post by:
hello.. I am new to VB and really new to LDAP I am trying to write an application for our lunch card system...where a student's card is read by a barcode reader and the information (a string)...
0
by: crossroadsk | last post by:
I have a problem in configuring JNDI properties for LDAP server i created jndi.properties file in the current directory where i'm running a simple java code. jndi.properties file which i...
3
by: RJN | last post by:
Hi I've written a code that queries Windows LDAP server and works fine, but the same doesn't work when querying Solaris LDAP server. DirectoryEntry de = new...
3
by: eleland | last post by:
I am trying to bind to an LDAP server using php without success. I have a linux server running php compiled with open ldap. I am using the following code taken right from php.net: echo "<h3>LDAP...
0
LeoTD
by: LeoTD | last post by:
Dear all, I have a some problem when connect and get data from LDAP server using PHP. My PHP server use Linux. Example: I have field ObjectID in LDAP server with value is string 32...
1
by: sowing | last post by:
I am trying to bind to a LDAP server, but failed. Code as follow: #!/usr/bin/perl use strict; use warnings; use Net::LDAP; use Data::Dumper; use Net::LDAP::Util qw(ldap_error_name ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.