Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 999759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:24:17+00:00 2026-05-16T07:24:17+00:00

Using the standard ASP.NET login control, I’m trying to get it to deny me

  • 0

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.

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

and code behind (Pseudo code.. doesn’t work)

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
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:24:17+00:00Added an answer on May 16, 2026 at 7:24 am

    Actually, you don’t have to do it in the code. You can put in a web.config’s Authorization section to block access rather than disallow a login. It’s perfectly legitimate to have a user logged in but no rights.

    <deny roles="canceled">
    

    If you think about it, it makes sense. We have a site that has an admin folder locked down by putting a web.config to restrict by setting

    so someone logged in as another user level would be locked out. Using my suggestion, you’re specifically locking out users in the “canceled” role in the config file, which is usually preferrable to code that needs to be compiled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ASP.NET WebForms. I'm using the standard sitemap provider. Home > User >
I'm attempting to convert a home-grown login system to the standard asp.net login control
We're using the standard ASP.NET authentication provider (AspNetSqlMembershipProvider as it happens) and the defualt
I'm using a standard asp.net menu in an asp.net 4.0 web application. To clarify,
I have an ASP.NET 3.5 Web Site using the standard SQL Membership Provider. The
In our standard web forms ASP.NET solutions we typically have a range of user
I'm using standard ASP.NET and a Web.sitemap file which describes the navigation structure of
What is the standard way to maintain a stable user session in ASP.NET without
I am having trouble defining bindings using ninject. I am in a standard ASP.NET
I'm deciding between using ASP.NET MVC, or standard ASP.NET Web Forms with URL routing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.