Re: IsInRole Performance Issue
From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 04/29/05
- Next message: Joe Kaplan \(MVP - ADSI\): "Re: Save/retrieve certificate in Active Directory"
- Previous message: Guest: "Re: print to network printer using ASP.NET on IIS6 (2003 Server)"
- In reply to: toddca: "Re: IsInRole Performance Issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 29 Apr 2005 09:49:23 -0500
Hey Todd!
That's a great post. Thanks for putting that together.
I really like your approach of resolve the role into a SID and check that
directly against the token instead of the other way around. It is very
common for the application to be interested in a pretty small number of
different groups/roles, so it really makes sense to do it this way.
Another behavior that I've noticed is that tends to affect performance is
that the ASP.NET model creates a new WindowsIdentity/WindowsPrincipal object
for each request instead of reusing an existing one. The internal hashtable
that holds the resolved group names needs to get reinitialized for each
request, which can also be slow. Simply caching the WindowsPrincipal and
reusing will make subsequent calls IsInRole MUCH faster.
This doesn't address the issue of the slow initial resolution like your code
does. I was just pointing out another subtle issue with the current model.
Thanks again!
Joe K.
"toddca" <toddca.1o8shs@mail.codecomments.com> wrote in message
news:toddca.1o8shs@mail.codecomments.com...
>
> moverton wrote:
>> *David, did you ever resolve this problem? We are seeing very
>> similar problems.
>> -mark *
>
> Hey guys check out my blog on this subject,
> [url]http://blogs.msdn.com/toddca[/url]
>
>
>
> --
> toddca
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>
- Next message: Joe Kaplan \(MVP - ADSI\): "Re: Save/retrieve certificate in Active Directory"
- Previous message: Guest: "Re: print to network printer using ASP.NET on IIS6 (2003 Server)"
- In reply to: toddca: "Re: IsInRole Performance Issue"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|