0
使用标准的ASP.NET登录控制,我试图让它拒绝我登录,如果用户谁试图登录成员的取消组。ASP.NET登录控制 - 拒绝登录,如果在一个角色
<asp:Login ID="Login1" runat="server" OnLoggedIn="Login1_LoggedIn" DestinationPageUrl="~/Default.aspx" FailureText="Whoops - something went wrong with your login. <br />Please try again. <br />If you've forgotton you password please click link below and we'll send you a new one" >
<LayoutTemplate>
<table cellpadding="1" cellspacing="0" style="border-collapse:collapse;">
<tr>
和后面的代码(伪代码..不工作)
protected void Login1_LoggedIn(object sender, EventArgs e)
{
var profile = WebProfile.GetProfile(UserManager.GetCurrentUserName());
if User.IsInRole("cancelled") {
FormsAuthentication.SignOut();
// write out a message saying you are not allowed to login
}
}
不错的一个...干杯 – 2010-08-19 07:05:53