Hi Peter, Thank you for the reply. You're quite right of course, I
created this code in a overly-simplistic manner to try to isolate the
source of error to the custom role assignment. While it appears that
the roles are assigned successfully in the
WindowsAuthentication_Authenticate method, these roles are not
available from the page. (Once this problem is complete, I'll be
supplying the roles from a database, and using the user's identity as
the index into the data)
Thanks Peter.
Peter Bromberg [C# MVP] wrote:
Jeff,
At first blush it appears you are attempting to have your cake and eat it
too. The whole concept of authentication is to create a custom Identity based
on the user's credentials, no? In this case you are forcing it to be
"mycomputer/me"... no matter who it is.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Jeff Deville" wrote:
I'd like to create customer roles for my ASP.Net application, but I am
also using impersonation. For the purposes of this issue, say I have
the simple code below for my custom roles.:
Overrides Sub Init()
_ht = New Hashtable
_ht.Add("mycomputer/me", New String() {"ViewAll",
"ViewPublished"})
End Sub
Sub WindowsAuthentication_Authenticate(ByVal s As Object, ByVal e As
WindowsAuthenticationEventArgs)
e.User = New GenericPrincipal(e.Identity, _ht("mycomputer/me"))
End Sub
The problem is that I don't have access to the custom roles in my page
code. I've read that this has something to do w/ impersonation
happening after the WindowsAuthentication_Authenticate method is
called. The problem is that the User object seems to be read only
after this, so in what method can I assign these custom roles?
Thanks
-j