473,398 Members | 2,393 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,398 software developers and data experts.

Missing properties when querying for non-admin users in AD

I am trying to get user information out of AD (specifically the memberOf
property) from an ASP.net page and am having a strange problem. If the
user I query for is an administrator in the domain then I get a complete
list of all properties, including the one I need. However, if the user
that I query for is not an admin, I get back a much more limited set of
properties that doesn't include (among many other things) memberOf.

If I hard-code my username/password into the DirectoryEntry instance
that I use, I am able to get the complete property set for anyone, so I
figure there has to be an authentication issue somewhere. As far as I
can tell by default DirectoryEntry uses AuthenticationTypes.None, but I
am not sure exactly how AD treats this.

If I run this same code as a console application on the same server from
the same account that I tested hard-coding with above, everything works
great.

--

private void Page_Load(object sender, System.EventArgs e) {
string role = "accounting".ToLower();
DirectorySearcher ds = new DirectorySearcher(new DirectoryEntry(null));
ds.Filter = "(sAMAccountName=" + Request.QueryString["username"] + ")";

SearchResult sr = ds.FindOne();
DirectoryEntry de = sr.GetDirectoryEntry();

PropertyValueCollection dir = de.Properties["memberOf"];
Response.Write("<p>Group Count:" + dir.Count + "</p>");
for(int i = 0; i < dir.Count; ++i) {
string currentItem = dir[i].ToString();
currentItem = currentItem.Substring(currentItem.IndexOf("CN=")+3 );
currentItem = currentItem.Substring(0,currentItem.IndexOf(","));
Response.Write("<p>" + currentItem + "</p>");
}
}
--

Please let me know if you have any ideas about what I can do to make
this work!

Thanks a lot in advance.

- Eric
Nov 19 '05 #1
0 948

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

Similar topics

3
by: Verve | last post by:
I am writing a program in .Net to retrieve properties of Sql Server. How can I find the following properties without querying the database: 1. Replication enabled 2. Default language 3....
7
by: Corepaul | last post by:
Missing Help Files When I enter "recordset" as the keyword and search the Visual Basic Help index, I get many topics of interest in the resulting list. But there isn't any information available...
0
by: vooose | last post by:
Consider a UserControl to which you do userControl.Paint += new PaintEventHandler(paint_method) If you don't like that way, and prefer to override onPaint( ) then the problem stated below...
8
by: Tony Liu | last post by:
I am having a "Null Device is Missing" compile error when compiling a c++ project. The documentation from MSDN said it could be caused by low system resource or the user account does not have...
1
by: rb | last post by:
I'm a bit confused with this new data binding methodology - well, at least the "visual" part of it. With asp.net 1, I used be able to "mouse-my-way" around data binding instead of doing it in...
7
by: Michelangelo | last post by:
Hi All, I hace created a sample user control in Visual Studio .NET (2003); I have been able to compile and use it (add it to a form) in a test standard windows application, but when I try to...
0
by: mpar16 | last post by:
Hi i needed help me to retrieve properties of a control, i got a scenario to read all available properties and its current assigned values for different controls in project. i tried with...
11
by: phnimx | last post by:
I've completed migrating one of our company's C++ Managed Code applications to VS2005. I'm now attempting to run the application but there seems to be problems when accessing an object that is...
11
by: Andrus | last post by:
I'm implementing entity object which should populate its properties from database when property is first referenced. In RDL reports I use object properties like MyObject.MyProperty MyObject...
0
by: Henry | last post by:
Hello, I have linked to an Oracle table using Access 2003. The Oracle table contains a PRICE field which has decimal data such as 15.50. When querying this data with Access, 1550 is displayed....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.