LDAP with ASP.net
-
Hi, I am trying to authenticate a user by using his Windows credentials on an intranet website. In my web.config I have authentication set to Windows and in IIS I have enabled Integrated Windows authentication on my virtual directory. I am using System.DirectoryServices also I have the following code snippet written in C#
DirectoryEntry direntry = new DirectoryEntry("LDAP://DC=xyz,DC=COM",Text1.text,Text2.Text); Try { Object nat; nat = direntry.NativeObject; Response.Redirect("~/Forms/someform.aspx"); } catch(Exception e) { }
The above mentioned code works only for a particular username and password and for all others the code throws a System.DirectoryServices.DirectoryServicesCOMException. I do not have any impersonation enabled in my web.config. Any more inputs from my side or is this info sufficient for anybody trying to throw some light on the problem. Thanx in advance.