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 319781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:41:35+00:00 2026-05-12T08:41:35+00:00

I’ve been working with the .net login for a long time now, but my

  • 0

I’ve been working with the .net login for a long time now, but my latest project calls for some not so great coding.

I have one database which contains the tables etc for .net membership.
There are 4 roles:

  • Admin
  • BasicAdmin
  • PowerAdmin
  • Member

Now the top 3 are able to log into the Admin system, but I want to deny login for those in the role Member, I have added in the following to the webconfig:

<authorization>
  <deny roles="Member"/>
  <deny users="?"/>
</authorization>

this works, to an extent. It redirects the user who is in the role ‘Member’ to the login page, but it does not give the message login failed, as you would get when you are not registered and you enter wrong data.

The members can log into a members area of the site which will be for arguement sake off limits to admins.

Does anyone know where I am going wrong, am I missing something or is this not possible?

Thanks,

  • 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-12T08:41:35+00:00Added an answer on May 12, 2026 at 8:41 am

    Your members can login and get to the member content but are then redirected when they attempt to get to something in the admin section. It is working by design. The member wouldn’t get a failed login message because they have not failed to login, rather they are denied access.

    Throughout the application you can check as a person is trying to go to page that they can’t access and fire off a message that they don’t have access but that is extra work but doable.

    You can also modify your application in such a way that links to certain sections of the site only show if the user is in the right role. For example, Roles.IsUserInRole(“role”) will check the currently logged in identity / user is in a role. There is also the LoginView control in 2.0 that you can wrap controls in that do this nicely for you.

    EDIT: Clarification based on your first comment.

    This is how the roles provider is designed. It redirects you to the login page when you try to access a page you have been denied in the web.config for.

    You could do a couple of things:

    Remove the deny statements for the groups in the web.config and then do one of two things or both:

    Use the loginview control and encapsulate the functionality for the “admin” role in the admin view and then display a message to the “member” role that they don’t have access.

    And/Or write code on the page load event for a page checking the roles and presenting a message and/or redirecting a user to another page.

    OR leave the deny statement in the web.config for the groups AND

    on the page load event of the login page do something like

            If  Me.User.Identity IsNot Nothing and Me.User.Identity.Isauthenticated Then
              If Me.User.IsInRole("admin") Then
                Response.Redirect("~NoAccessToMemberStuff.htm")
              Else If Me.User.IsInRole("member") Then
                Response.Redirect("~/NoAccessToAdminStuff.htm")
              End If
        End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

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.