Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / July 2004

Tip: Looking for answers? Try searching our database.

Need verification on RefreshCache method

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Henry - 14 Jul 2004 12:00 GMT
I feel rather confuse with the RefreshCache method. Let say I call the
method using the following code,

DirectoryEntry entry = new DirectoryEntry();
entry.Path = path;
entry.Username = userName;
entry.Password = password;
entry.AuthenticationType = AuthenticationType.None;
entry.RefreshCache( new string[] { "objectGuid", "distinguishedName" } );
Is that mean only the two attributes are loaded?

then why the next line gives value other than 2
int propCount = entry.Properties.Count;

Thanks
Joe Kaplan \(MVP - ADSI\) - 14 Jul 2004 15:09 GMT
What version of the .NET Framework are you using?  What are the other
attributes in the property cache?  Under 1.1, I get exactly the same
properties in the property cache that I asked for unless I did a normal
"default" load on the property cache before I asked for specific attributes.

Joe K.

> I feel rather confuse with the RefreshCache method. Let say I call the
> method using the following code,
[quoted text clipped - 11 lines]
>
> Thanks
Henry - 14 Jul 2004 16:09 GMT
Hi Joe, Thanks for answering.

I'm using .NET Framework 1.1. I didn't check the other attributes and my
understanding so far Properties.Count would gives the exact number of
available attributes in the property cache but why it returned 12 instead of
2? Forgot to mention I'm using ADAM.

"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
> What version of the .NET Framework are you using?  What are the other
> attributes in the property cache?  Under 1.1, I get exactly the same
[quoted text clipped - 18 lines]
> >
> > Thanks
Joe Kaplan \(MVP - ADSI\) - 14 Jul 2004 17:13 GMT
I checked in my ADAM instance and got exactly the same behavior as I did
with AD.  Are you sure you didn't do anything before the RefreshCache that
you show in your code that might have loaded the default property cache?

Joe K.

> Hi Joe, Thanks for answering.
>
[quoted text clipped - 28 lines]
> > >
> > > Thanks
Henry - 15 Jul 2004 08:54 GMT
I found the problem, my mistake and it was a stupid one. Basically my
solutions contains a few tens of projects and some assemblies are being
loaded dynamically using reflection. When the solution is built one of the
projects is responsible to copy over the necessary dll to a web project and
it happened the build order was wrong. That's why when the code is modified
it's not get updated.

I still have two questions, though
1. Is it possible to bind and have no attribute loaded, I need this because
for some cases I don't need to do anything to any of the attributes.
2. I tried to bind a organizationalUnit object and call the RefreshCache in
a few ways. And this is the result,

-- RefreshCache( string[] {} ) -> passing empty array
Number of attributes returns: 11
1. objectClass
2. ou
3. distinguishedName
4. instanceType
5. whenCreated
6. whenChanged
7. uSNCreated
8. uSNChanged
9. name
10. objectGUID
11. objectCategory

-- RefreshCache() --> no parameter
Number of attributes returns: 12
1. objectClass
2. ou
3. distinguishedName
4. instanceType
5. whenCreated
6. whenChanged
7. uSNCreated
8. uSNChanged
9. name
10. objectGUID
11. objectCategory
12. nTSecurityDescriptor

Why the nTSecurityDescriptor attribute make the different? I'm not familiar
in any way in Active Directory, do you know any article which can explain
about all these?

Thanks

"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
> I checked in my ADAM instance and got exactly the same behavior as I did
> with AD.  Are you sure you didn't do anything before the RefreshCache that
[quoted text clipped - 35 lines]
> > > >
> > > > Thanks
Joe Kaplan \(MVP - ADSI\) - 15 Jul 2004 15:26 GMT
To force a bind without loading the property cache, the standard method is
to reference the NativeObject property.  People using AD to do LDAP
authentication tend to use it for this reason.

I'm going to have to take a guess on why the null array doesn't load the
ntSecurityDescriptor and the overload with no parameters loads it as I can't
look at the source right now.  I'll try to do that later.

My guess is that the ntSecurityDescriptor is a constructed attribute.
Generally constructed attributes like allowedAttributesEffective,
canonicalName and tokenGroups will not be returned from a base LDAP search
unless they are specifically requested.  My assumption is that the GetInfo
call (which is what happens when you do RefreshCache) asks for
ntSecurityDescriptor by default.  However, when you do a RefreshCache with
parameters specified, the corresponding GetInfoEx call gets passed straight
into a base level LDAP search.  An LDAP search with a null attribute array
specified returns all the attributes for that object (exept the constructed
ones or the ones you don't have permissions to see).

I hope that helps explain it and I hope it is correct :)

Joe K.

> I found the problem, my mistake and it was a stupid one. Basically my
> solutions contains a few tens of projects and some assemblies are being
[quoted text clipped - 88 lines]
> > > > >
> > > > > Thanks

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.