Last post Jun 10, 2014 02:00 PM by bbcompent1
Jun 06, 2014 11:53 AM|netrocks9|LINK
We have a .net web application hosted at Rackspace. Some users need to be authenticated across an AD domain that is different from Rackspace.
My code looks like this
using (PrincipalContext pc = new PrincipalContext(ContextType.Domain, mydomain))
// validate the credentials
ValidUser = pc.ValidateCredentials(UserName, Password);
I am getting the error : LDAP server is unavailable. The server could not be contacted.
Now I have tried the following versions for mydomain string with no luck:
What is the issue here?
Jun 06, 2014 11:57 AM|bbcompent1|LINK
I am not sure you can do that; the two AD forests do not have a trust relationship built and I sincerely doubt Rackspace is even using AD for web applications. Have you contacted their support to see if they indeed support that? Because you would need
to create teh trust relationship between them and open a firewall port to allow communication between both your AD and Rackspace.
Jun 06, 2014 12:50 PM|netrocks9|LINK
Thank you for a quick reply, bbcompent1. Rackspace says they do not support LDAP on the server. How do I authenticate users in such case?
Jun 06, 2014 12:56 PM|bbcompent1|LINK
I think in this situation if LDAP is absolutely essential, you may need to consider a VPS (virtual private server). Generally, with internet authentication, we usually will use the in-built roles authentication that is part of asp.net and in some cases
the newer ASP.NET Identity system which lets you tie into authentication schemes like Facebook, Google, etc. This may do what you need, again might do it:
Jun 10, 2014 01:56 PM|netrocks9|LINK
Well, after troubleshooting for some time, we were told that we were given a wrong ldap domain name! Also, looks like PrincipalContext only works against Active Directory. DirectoryEntry saved our day. Below is the code that worked:
//domainName is something like ldap.abc.com, UserName is domain\username
DirectoryEntry entry = new DirectoryEntry("LDAP://" + domainName,
UserName, Password, AuthenticationTypes.Secure);
object nativeObject = entry.NativeObject; //some code
catch (System.Runtime.InteropServices.COMException e)
bbcompent1 for your input.
Jun 10, 2014 02:00 PM|bbcompent1|LINK
Well glad to hear it worked out for you in the end :)