Last post May 11, 2009 11:15 AM by abend
Apr 17, 2006 05:38 PM|Mike Hildner|LINK
I've searched and seen similar questions (but no answers), just looking for clarification if indeed there is an issue with the .LoggedIn event.
Documentation states it occurs after the user has been authenticated, but User.Identity.IsAuthenticated returns false and both User.Identity.AuthenticationType and .Name are empty strings.
I'd like to redirect the user based on .IsInRole().
I'm about to write my own .IsInRole method based on the user name, which is no big deal. Just wondering if I'm missing something or not.
Apr 18, 2006 02:11 AM|ScottGu|LINK
The LoggedIn event fires immediately after the user is logged in with the login control -- but not before the next request to the site. As such, the User object isn't filled out yet.
You'll want to use the Login control's UserName property to look up the current user's name. You can then Roles.IsUserInRole(Login1.UserName, roleName) to see whether they are in a specific role.
Hope this helps,
Apr 18, 2006 03:44 PM|Mike Hildner|LINK
Thanks Scott, I appreciate the information. I didn't know about Roles.IsUserInRole().
Jun 25, 2006 05:11 PM|drdruish|LINK
May 11, 2009 11:15 AM|abend|LINK
Also, you can do a Response.Redirect in the Login1_LoggedIn Event (since this only fires upon authentication) to a handler
In the handler you use context.user.isinrole("YourRoleHere")
This way you can leave the login and default settings in your web.config's form section...