473,657 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

An operations error occurred while accessing active directory

31 New Member
hi all

i am doing a web site with single sign on technique. I am getting the error "COMExcepti on (0x80072020): An operations error occurred" while executing the statement

foreach (SearchResult AdObj in objsearch.FindA ll())

I can run the application in the local server but not by remote client. so please tell me the solution for it.

the code is:

strAppPath = "LDAP://myServer/CN=user,CN=user s,DC=sample,DC= testprjs,DC=com "

public bool authenticateUse r(string userName, string password)
{
DataTable dtDBUser = new DataTable("User InDB");
dtDBUser.Column s.Add("UName");
dtDBUser.Column s.Add("Pwd");
dtDBUser.Column s.Add("UDomain" );

DataRow dr;
dr = dtDBUser.NewRow ();
dr[0] = "gdhanasekaran" ;
dr[1] = "dhana";
dr[2] = "chennai";
dtDBUser.Rows.A dd(dr);

DirectoryEntry deRoot = new DirectoryEntry( strAppPath);
DirectorySearch er objsearch = new DirectorySearch er();
objsearch.Filte r = "(objectClass=u ser)";
objsearch.Searc hScope = SearchScope.Sub tree;
string strCN = "";
foreach (SearchResult AdObj in objsearch.FindA ll())
{
strCN += //System.Director yServices.Activ eDirectory.Doma in.GetCurrentDo main().Name + "\n" +
AdObj.Propertie s["SAMAccountName "][0] + "\n";
if (userName == Convert.ToStrin g(AdObj.Propert ies["SAMAccountName "][0]))
{
if (dtDBUser.Selec t("UName = '" + userName + "' ").Length > 0)
{
return true;
}
else
{
return false;
}
}
}
return false;
}

Thanks in Advance.

Regards,
Dhanasekaran.G
Feb 7 '08 #1
5 23110
dhanashivam
31 New Member
hi all

i am doing a web site with single sign on technique. I am getting the error "COMExcepti on (0x80072020): An operations error occurred" while executing the statement

foreach (SearchResult AdObj in objsearch.FindA ll())

I can run the application in the local server but not by remote client. so please tell me the solution for it.

the code is:

strAppPath = "LDAP://myServer/CN=user,CN=user s,DC=sample,DC= testprjs,DC=com "

public bool authenticateUse r(string userName, string password)
{
DataTable dtDBUser = new DataTable("User InDB");
dtDBUser.Column s.Add("UName");
dtDBUser.Column s.Add("Pwd");
dtDBUser.Column s.Add("UDomain" );

DataRow dr;
dr = dtDBUser.NewRow ();
dr[0] = "gdhanasekaran" ;
dr[1] = "dhana";
dr[2] = "chennai";
dtDBUser.Rows.A dd(dr);

DirectoryEntry deRoot = new DirectoryEntry( strAppPath);
DirectorySearch er objsearch = new DirectorySearch er();
objsearch.Filte r = "(objectClass=u ser)";
objsearch.Searc hScope = SearchScope.Sub tree;
string strCN = "";
foreach (SearchResult AdObj in objsearch.FindA ll())
{
strCN += //System.Director yServices.Activ eDirectory.Doma in.Ge tCurrentDomain( ).Name + "\n" +
AdObj.Propertie s["SAMAccountName "][0] + "\n";
if (userName == Convert.ToStrin g(AdObj.Propert ies["SAMAccountName "][0]))
{
if (dtDBUser.Selec t("UName = '" + userName + "' ").Length > 0)
{
return true;
}
else
{
return false;
}
}
}
return false;
}

Thanks in Advance.

Regards,
Dhanasekaran.G
Feb 8 '08 #2
dhanashivam
31 New Member
hi,

i want to create an user account which will allow all the users to access the particular site. This user account is belogs to an Active Directory.

So can you please tell me what are the permissions/ rights should be given for the user account to achieve the task.

Thanks in Advance.

Regards,
Dhanasekaran. G
Feb 8 '08 #3
radcaesar
759 Recognized Expert Contributor
http://www.pingzine.co m/blogs/?p=13
Feb 8 '08 #4
dhanashivam
31 New Member
hi,

thanks for your reply. but i could not achieve the task. The article describes how to make the web site as accesible for all the users.

but i need to get the list of users from the active directory thru my web site. The site works fine while running from the server as well as not working from the remote machine.

thats why i am requesting to create an user who has the permissions to access the active directory.

please help me.

Regards,
Dhanasekaran. G
Feb 8 '08 #5
dhanashivam
31 New Member
hi,

i got conclusion for accessing the active directory.

the IIS settings for the site which access the active directory should have the following.

1. Check the Annonymous access

2. Give a valid domain user name and its password in the specified portion.

3. Clear Allow IIS to Control password.

4. Check the Integrated Windows Authentication.

5. Add the Impersonate = true in your web.config file.

By these settings only you can read the users from the active directory.

Absense of anyone will not allow you to access the active directory

Regards,
Dhanasekaran. G[/quote]
Feb 12 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
7127
by: Brandon Arnold | last post by:
Hello All, I have a linked ADSI Server to our company Active Directory and everything is fine. I'm running queries and such using LDAP. BUT how can I aquire a list of attributes for the classes and categories. Such as if i wanted to see a user's telephone number and email address for use in a corporate database? Is this possible? Thanks
2
2881
by: Neil S. | last post by:
I'm a bit of a newbie to C++, so I apologize in advance if this is silly. I've found many examples of binding to AD with ADsOpenObject or IADsOpenDsObject. I can't compile my code. I've tried including every header that would be appropriate. I always get "error LNK2020: unresolved token(0A0000C1)IID_IADsOpenDSObject" or whatever other IID* value I pass in as the second param to the function. I've also tried the ADsOpenObject...
1
2159
by: unerwartet | last post by:
Hi, I want to access the high-watermark-vector of a specific domain controller in the active directory from c#. But I do not know how to achieve this. I tried it with: LDAP://CN=TheDomainController,OU=Domain Controllers,DC=my,DC=domain,DC=net
0
912
by: Jeremy Chapman | last post by:
I built a page to view user ActiveDirectory object properties. On my machine it works well, however when I moved the page to a different machine I get exceptions being thrown when trying to view some of the properties, such as middleName. The error is 'The directory datatype cannot be converted to/from a native DS datatype' The page is set to impersonate, and the app uses windows authentication....
8
1366
by: thomson | last post by:
Hi, Is it possible to access the user information from a Web Application, Iam not able to use System.DirectoryServices from my code behind.---using System.DirectoryServices What am i missing? Thanks in Advance thomson
2
334
by: Conversão .cs em .dll | last post by:
I'm having a problem accessing Active Directory, the problem is that I need to access the passwords of the user to validate a login that i'm doing. I have access for the usernames but not to there passwords. Can anyone help me Thanks João Felgueiras
4
1198
by: pankajit09 | last post by:
Hello, Is LDAP the only way to access the active directory ?
0
8844
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.