开发者

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. Administrator

I 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜