473,387 Members | 1,502 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,387 software developers and data experts.

The dread COMException (0x80004005): Unspecified error...

Well, the problem I'am having now applies to web applications only.
Therefore, I believe it has something to do with security settings. Here's
the code:

-------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim child As System.DirectoryServices.DirectoryEntry

' dirEntry is a DirectoryEntry component that points to
' WinNT://someserver
' I tried to retrieve the current user Active Directory information by
' using the Find function and specifying the logon userId and which
' schema the user belongs to. In this case, "User"...

child = dirEntry.Children.Find(getCurrentUserId, "User")

' lb is a ListBox

lb.DataSource = child.Properties()
End Sub

Public Function getCurrentUserId() As String

' I attempt to retrieve the current user windows logon id with the
' domain name removed using a Spilt("/") but it returns an empty
' string instead

Return
System.Security.Principal.WindowsIdentity.GetCurre nt.Name.Spilt("/")(1)
End Function
-------------------------------------------------------------------

After launching the site, the following error occurs:

-------------------------------------------------------------------
[COMException (0x80004005): Unspecified error
]
System.DirectoryServices.Interop.IAdsContainer.Get Object(String
className, String relativeName) +0
System.DirectoryServices.DirectoryEntries.Find(Str ing name, String
schemaClassName)
ADSearch.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\
wwwroot\ADSearch\WebForm1.aspx.vb:36
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
-------------------------------------------------------------------

I've tried using only the windows logon userId(dirEntry.Children.Find
(getCurrentUserId)) to retrieve the Active Directory entry for the current
user but the error still comes back.

I'am at my wits end...
solutions anyone?

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
2 4957

The user under which your application is running (most likely
IUSR_SERVERNAME) might not have permissions to access AD.
You should configure the virtual directory's security to run under a user
that has permissions to do so. Simply create a separate account for it in AD
and use it as the anonymous user (in IIS properties).
Alternatively, you can use ASP.NET impersonation configurable in web.config
(search MSDN for it).

Try doing the same AD stuff from a winforms application, and see if it's
indeed the problem with permissions.

-Oleg.

"Shihao Png via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in
message news:2a******************************@DotNetMonste r.com...
Well, the problem I'am having now applies to web applications only.
Therefore, I believe it has something to do with security settings. Here's
the code:

-------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim child As System.DirectoryServices.DirectoryEntry

' dirEntry is a DirectoryEntry component that points to
' WinNT://someserver
' I tried to retrieve the current user Active Directory information by
' using the Find function and specifying the logon userId and which
' schema the user belongs to. In this case, "User"...

child = dirEntry.Children.Find(getCurrentUserId, "User")

' lb is a ListBox

lb.DataSource = child.Properties()
End Sub

Public Function getCurrentUserId() As String

' I attempt to retrieve the current user windows logon id with the
' domain name removed using a Spilt("/") but it returns an empty
' string instead

Return
System.Security.Principal.WindowsIdentity.GetCurre nt.Name.Spilt("/")(1)
End Function
-------------------------------------------------------------------

After launching the site, the following error occurs:

-------------------------------------------------------------------
[COMException (0x80004005): Unspecified error
]
System.DirectoryServices.Interop.IAdsContainer.Get Object(String
className, String relativeName) +0
System.DirectoryServices.DirectoryEntries.Find(Str ing name, String
schemaClassName)
ADSearch.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\
wwwroot\ADSearch\WebForm1.aspx.vb:36
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
-------------------------------------------------------------------

I've tried using only the windows logon userId(dirEntry.Children.Find
(getCurrentUserId)) to retrieve the Active Directory entry for the current
user but the error still comes back.

I'am at my wits end...
solutions anyone?

--
Message posted via http://www.dotnetmonster.com

Nov 19 '05 #2
Sorry but I don't really get what you mean...do you mean that the user
account that I run on when I attempt to search AD do not have the
permission to do so by the AD server? So that means I should configure AD
so that it allows searching by my user account? Is that what you mean?

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: rOadhOg | last post by:
Help please! I set up a simple access 2000 database and I'm running IIS5. The first time I try it, it works, then it seems like I have to wait for some kind of time out for it to work again,...
5
by: khan | last post by:
Error Type: CreateRecordset (0x80004005) Unspecified error /finalsite/SearchResults.asp, line 47 this is my code can any one help plz why I am getting ths error <html> <head>
2
by: Jim Lacenski | last post by:
I have a VB class that uses .NET and ADODB to write into an Excel spreadsheet (via Jet) on a server as part of a web application. ADODB is used instead of ADO.NET because it greatly simplifies the...
2
by: Bassel Tabbara | last post by:
I wrote the following code: oApp = new Outlook.Application(); oApp = new Outlook.Application(); oNameSpace= oApp.GetNamespace("MAPI"); oNameSpace.Logon(null,null,true,true); //gets defaultfolder...
7
by: Jim McGivney | last post by:
ASPX page from VS.net-C# on host's computer using oleDataAdaptor to connect to Microsoft Access database. The page loads, but when connection to the database is attempted to fill a datagrid the...
0
by: mamin | last post by:
Hi! While running my asp application under Windows 2000 the following error appears: Microsoft JET Database Engine (0x80004005) Unspecified error I've installed MS Jet 4.0 SP1 and MDAC 2.8 SP1...
4
by: dynastar | last post by:
I'm trying to send custom COMExceptions from my C# server. My test client in C# has no problem reading the HRESULT I send (say, 0x80040002). Needless to say, the MFC client in C++ allows this...
2
by: javediq143 | last post by:
Hi all, I set up a simple access database.Earlier my ASP page was working fine,but dont know whats gone wrong that it started to give me this Err: Error Type: Provider (0x80004005) Unspecified...
2
by: kanman | last post by:
hi all. im developing a web based application using asp.net i'm getting this error below: and idea on where the problem is and how to fix? thank you in advance Kanman
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.