ASP.NET Membership Show "This type of user does not have permission"
I am learning the ASP.NET Membership and making an admin login page. I have two types of users:
1. Normal user 2. AdministratorI want to show "This type of user does not have pe开发者_开发技巧rmission" when a normal user logins through the login page.
What should I do? I am using asp.net login control. Add code in function Login1_LoggedIn? or Login1_Authenticate?
You'll get this event sequence:
- Authenticate: that username/password matches anything in your database?
- LoggedIn: fires after a successful call to Authenticate; here you have access to user profile with
Roles.IsUserInRole()
method
This article series can be really useful to you: Examining ASP.NET's Membership, Roles, and Profile
Finally, I check roles in the Login1_Authenticate function and it works.
精彩评论