Ask a Question related to ASP.NET Security, Design and Development.
-
Brian Stevenson #1
DirectoryEntry works for anonymous, but not for usern/pass
I'm racking my brain over this problem. I can get DirectoryEntry to
bind to a DirectoryEntry object anonymously without any problem, but
when I try to bind with a username and password, it doesn't work.
Environment:
Windows 2000 Server / IIS 5.0
Novell's LDAP server (running NetWare 5.1)
Code snippet:
Public Function Login() As Boolean
Dim root As New
System.DirectoryServices.DirectoryEntry("LDAP://10.99.5.92/O=Fishel","USERNAME","PASSWORD")
Dim searcher As New
System.DirectoryServices.DirectorySearcher(root)
searcher.Filter = "(&(objectClass=user)(cn= " & Me.Username &
"))"
Dim results As SearchResultCollection
results = searcher.FindAll()
Dim result As SearchResult
For Each result In results
' CODE TO BIND TO EACH OBJECT FOUND IN THE SEARCH AND TRY THE
USER'S USER/PASS COMBO. NOT YET WRITTEN.
Next result
End Function
The above code will work when I take out the "USERNAME" and
"PASSWORD", but when present, the following error for some attributes
in the local debug window reads:
Name <error: an exception of type:
System.Runtime.InteropServices.COMException} occurred> String
When is should read something like:
Name O=Fishel String
I also get the following error on the web form....
An invalid dn syntax has been specified
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: An
invalid dn syntax has been specified
Stack Trace:
[COMException (0x80072032): An invalid dn syntax has been specified]
System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
+513
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_AdsObj ect() +10
System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne) +199
System.DirectoryServices.DirectorySearcher.FindAll () +10
TeamFishel.OWNS.BLL.Authenticate.Login() in T:\Home\Visual Studio
Projects\TeamFishel.OWNS.BLL\Authenticate.vb:57
TeamFishel.OWNS.WebUI.Login.loginButton_Click(Obje ct sender,
EventArgs e) in C:\Documents and
Settings\bgstevenson\VSWebCache\dotnet.intra.fishe lco.com\OWNS\Login.aspx.vb:34
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain() +1263
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.288;
ASP.NET Version:1.0.3705.288
Line #57 is:
results = searcher.FindAll()
Does anyone have any thoughts about why this is happening?
Sincerely,
Brian
Brian Stevenson Guest
-
path for DirectoryEntry
Hi All I have a directory server hosting multiple OUs, and I found that all the users I created under each OU will not appear under "Users"... -
Binding DirectoryEntry to AD object via GUID
I notice in the help files a reference that implies that you can create a DirectoryEntry object that binds directly to an active directory object... -
Directoryentry.bind
Hi I have a webapp that does queries against active directory. The app works fine when run from the local machine, but doesn't when run from... -
<input type='image'> ... IE fails to pass value while Mozilla and Netsacpe works
newsgroup... I have found that the <input type=image'> passes a value when interpeted with Netscape or Mozilla but NOT with IE. Consider the... -
DirectoryEntry and CopyTo function
Hi I am struggling to make a Web site/Web Directory copy work. I am using the System.DirectoryServices to connect to my localhost machine. ...



Reply With Quote

