ASP.NET Login Control - Deny login if in a role
<p>Using the standard ASP.NET login control, I'm trying to get it to deny me login, if the user who is trying to login in a member of the cancelled group.</p>

<pre><code>&lt;asp:Login ID="Login1" runat="server" OnLoggedIn="Login1_LoggedIn" DestinationPageUrl="~/Default.aspx" FailureText="Whoops - something went wrong with your login.  &lt;br /&gt;Please try again.  &lt;br /&gt;If you've forgotton you password please click link below and we'll send you a new one" &gt;
    &lt;LayoutTemplate&gt;
        &lt;table cellpadding="1" cellspacing="0" style="border-collapse:collapse;"&gt;
            &lt;tr&gt;
</code></pre>

<p>and code behind (Pseudo code.. doesn't work)</p>

<pre><code>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
        }
    }
</code></pre>
