Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Active Directory, LDAP and Forms Authentication Problem

Reply
Thread Tools

Active Directory, LDAP and Forms Authentication Problem

 
 
Ken Dourado
Guest
Posts: n/a
 
      11-10-2003

Hi,

I've got an intranet ASP.NET application that uses Forms Authentication.
What I'd like to do is get the username (in the format name.surname) of
the visitor and then retrieve their Display Name from Active Directory
using the following method:

internal static string GetUserDisplayName(string id)
{
string html = "";
DirectoryEntry objDomain = new DirectoryEntry("LDAP://DOMAINNAME");
DirectorySearcher objSearcher = new DirectorySearcher(objDomain);
objSearcher.Filter = ("(objectClass=user)(sn=" + id ")");
foreach(SearchResult sr in objSearcher.FindAll()) // this line errors
{
DirectoryEntry de = sr.GetDirectoryEntry();
html = de.Properties["DisplayName"].Value.ToString() + "<br>";
}
return html;
}

I keep getting the following error message:
System.Runtime.InteropServices.COMException: The directory service is
unavailable

I'm a newbie at this so I don't really understand where I'm going wrong
or if I have to set anything up before carrying on.

Thanks in advance for any help.

Regards,

Ken.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best practices for using forms authentication and security in a hosted env (was: Re: Using a Forms authentication in a shared hosting environment) JEFF ASP .Net 1 11-12-2007 07:00 PM
forms authentication -- expired forms cookie vs. not provided forms cookie Eric ASP .Net Security 2 01-27-2006 10:09 PM
Forms Authentication with Active Directory LDAP Problem Tdar ASP .Net 2 10-11-2005 08:52 PM
Forms Authentication with Active Directory LDAP Problem Tdar ASP .Net Security 1 09-30-2005 08:17 AM
Forms Authentication question: How to have some pages open and some requiring forms authentication Eric ASP .Net 2 02-13-2004 02:14 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57