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

Operations error

I'm trying in ASP.NET web page load user accounts from active directory.
When I'm developing on local web server it works.
I'm using authentication mode=windows and identity impersonate=true
When I put page and DLL on server I get COMException. I try to run it on
Win2000 server and Win2003 server and I get the same results (COMException)
Can anyone help ?



Server Error in '/ADSearchNtsrvprnTest' Application.
--------------------------------------------------------------------------------

An operations error occurred
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
operations error occurred

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[COMException (0x80072020): An operations error occurred]
System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) +705
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_AdsObj ect() +10
System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne) +199
System.DirectoryServices.DirectorySearcher.FindOne () +31
ADSearchNtsrvprnTest.WebForm1.GetAllUsersInfo1(Str ing Root) in
\\ntsrvprn\wwwroot$\adsearchntsrvprntest\webform1. aspx.cs:76
ADSearchNtsrvprnTest.WebForm1.Page_Load(Object sender, EventArgs e) in
\\ntsrvprn\wwwroot$\adsearchntsrvprntest\webform1. aspx.cs:29
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +739

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032
Mar 24 '06 #1
6 2775
Debug and determine exactly what line is throwing the exception

Mar 24 '06 #2
Can you post the actual code that is generating the error?
Mar 24 '06 #3
"jeff" <yu****@yup.com> wrote in message
news:cd******************************@ureader.com. ..
Can you post the actual code that is generating the error?

Here is full code:

using System;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Runtime.InteropServices;
using System.DirectoryServices;

namespace ADSearchWebTest
{
/// <summary>
/// Summary description for WebForm1.
/// </summary>
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
UserInfo1[] arr;
arr = GetAllUsersInfo1("DC=MyDomain,DC=com");
string strFormat = "{0};{1};{2}";
for (int Index=0; Index < arr.Length; Index++)
{
Response.Write(string.Format(strFormat, arr[Index].ID,
arr[Index].CeleMeno, arr[Index].OsC));
}
}
}

//-----------------------------------------------------------------------------------------------------------------
private static string GetDefaultADRoot()
{
DirectoryEntry objDE = new DirectoryEntry("LDAP://rootDSE");
string strReturn =
objDE.Properties["defaultNamingContext"].Value.ToString();
objDE.Close();
return strReturn;
}

//-----------------------------------------------------------------------------------------------------------------
public static UserInfo1[] GetAllUsersInfo1(string Root)
{
string strRoot;
if (Root != null)
{
if (Root.Length > 256)
throw new ArgumentOutOfRangeException("Root");
strRoot = Root;
}
else
strRoot = GetDefaultADRoot();
DirectoryEntry RootEntry = new DirectoryEntry("LDAP://" + strRoot);

DirectorySearcher mySearcher =
new DirectorySearcher(RootEntry,
"(&(objectCategory=person)(objectClass=user))" ,
new string[] {"objectGUID", "displayName", "EmployeeID"},
SearchScope.Subtree);
mySearcher.PageSize = 500;
SearchResultCollection srcResult = mySearcher.FindAll();
//RootEntry.Close();
if (srcResult.Count > 0)
{
UserInfo1[] arrReturn = new UserInfo1[srcResult.Count];
for (int Index=0; Index < srcResult.Count; Index++)
{
arrReturn[Index] = new UserInfo1();
arrReturn[Index].ID =
GetLDAPGUIDString((byte[])srcResult[Index].Properties["objectGUID"][0]);
if (srcResult[Index].Properties["displayName"] != null)
arrReturn[Index].CeleMeno =
srcResult[Index].Properties["displayName"][0].ToString();
if (srcResult[Index].Properties["EmployeeID"] != null)
arrReturn[Index].OsC =
srcResult[Index].Properties["EmployeeID"][0].ToString();
}
srcResult.Dispose();
mySearcher.Dispose();
return arrReturn;
}
else
return null;
}

//-----------------------------------------------------------------------------------------------------------------
private static string GetLDAPGUIDString(byte[] arrGiud)
{
StringBuilder sbuGuid = new StringBuilder(32);
string strFormat = "{0:X2}";
foreach (byte bByte in arrGiud)
sbuGuid.AppendFormat(strFormat, bByte);
return sbuGuid.ToString();
}
//-----------------------------------------------------------------------------------------------------------------
public class UserInfo1 : IComparable
{
public string ID, CeleMeno, OsC;

public int CompareTo(object obj)
{
if(obj is UserInfo1)
{
UserInfo1 objUI = (UserInfo1) obj;
return string.Compare(CeleMeno, objUI.CeleMeno, true);
}
throw new ArgumentException("Object is not UserInfo1");
}
}
//-------------------------------------------------------------------------------------------------------------------
}
}
Mar 25 '06 #4
That is all the code. Show "only" the code that is generating the error.

Mar 30 '06 #5

"sirfunusa" <si*******@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
That is all the code. Show "only" the code that is generating the error.

DirectoryEntry RootEntry = new DirectoryEntry("LDAP://" + strRoot);

DirectorySearcher mySearcher = new DirectorySearcher(RootEntry,
"(&(objectCategory=person)(objectClass=user))" ,
new string[] {"objectGUID", "displayName", "EmployeeID"},
SearchScope.Subtree);
Apr 4 '06 #6
Turn on Basic Authentication on the server. It's a permissions issue.
Locally you are using NT Auth, but that doesn't work across computer
boundries.

Yes, you'll get the user popup.

Apr 4 '06 #7

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

Similar topics

1
by: Navin | last post by:
Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. hi, guys i have asp application running on iis 5.0 windows 2000 i use...
3
by: Scott Brady Drummonds | last post by:
Hello, all, My most recent assignment has me working on a medium- to large-sized Windows-based C++ software project. My background is entirely on UNIX systems, where it appears that most of my...
3
by: laurenq uantrell | last post by:
I am trying to install SQL Server 2000 on a Win2K OS machine but I get this error message: "A previous program installation created pending file operations on the installation machine. You must...
28
by: robert | last post by:
In very rare cases a program crashes (hard to reproduce) : * several threads work on an object tree with dict's etc. in it. Items are added, deleted, iteration over .keys() ... ). The threads are...
16
by: Shawnk | last post by:
I would like to perform various boolean operations on bitmapped (FlagsAttribute) enum types for a state machine design as in; ------------------- enum portState { Unknown, Open,
2
by: Remi.Arntzen | last post by:
I tried to compile a program to a elf shared library for a Linux platform on a windows machine with the command: gcc -o Prog.so -shared -Wl,--oformat -Wl,elf32-i386 however this results in ld:...
4
by: alex | last post by:
hi friends ... i am facing a problem while detecting floating point operations in my project, please help me. i want to find out the places in my C/C++ project where i am doing floating...
27
by: David Marsh | last post by:
I understand that C99 supports a complex type and complex arithmetic. There is nothing about it in the FAQ and online searches turned up very little except synopses. Can anyone point me toward...
5
by: dhanashivam | last post by:
hi all i am doing a web site with single sign on technique. I am getting the error "COMException (0x80072020): An operations error occurred" while executing the statement foreach (SearchResult...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.