Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > isinrole reverts to windowsprincipal?

Reply
Thread Tools

isinrole reverts to windowsprincipal?

 
 
Vic
Guest
Posts: n/a
 
      11-26-2004
I'm trying to assign all roles (AD and custom pulled from SQL Table)
to users when they login to the app using Windows Authentication. The
code works fine for local users but fails for AD users if the IIS
server is a member server of the domain. It does seem to work however
if the IIS server is a domain controller (not an option,
unfortunately).

In the global.asax under the WindowsAuthentication_OnAuthenticate
event I grab all the WindowsPrincipal roles using reflection
(...GetMethod("GetRoles"...), grab all the custom roles from the db,
create a GenericPrincipal and assign them. I then assign the
GenericPrincipal to the HttpContext.Current.User.

On my first default.aspx page, I use reflection again to parse out the
roles of my HttpContext.User (...GetField("m_roles"...) and it returns
successfully all the roles I have assigned in the global.asax. The
HttpContext.Current.User.IsInRole("...") however consistently returns
false when checking for any of the SQL roles added, yet works for the
rest.

It seems that in the cases where it fails (windows authentication
against AD using AD account on an IIS member server), the IsInRole
seems to query exclusively against the ORIGINAL WindowsPrincipal,
regardless of what I attempt in my code. I have tried creating my own
custom principal class, played with impersonate options, tried using
Thread instead of HttpContext, etc... to no avail.

Anyone able to shed some light on why this is happening? And
hopefully provide me with a solution?

Victor
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
On restart my resolution reverts Kyote Computer Information 0 11-21-2007 08:54 AM
Web.config Always Reverts to authentication mode="Windows" DaBrain ASP .Net 0 11-02-2006 05:14 AM
Firefox home reverts to msn Mark Weedon Firefox 2 10-15-2006 02:06 PM
ASP.Net Site Reverts to old version plaztik via DotNetMonster.com ASP .Net 0 05-04-2005 05:03 PM
Canon PowerShot S1 IS proplem w/ image counter reverts to 667 al_b_bach@terminator.com Digital Photography 2 06-17-2004 04:27 AM



Advertisments