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

  • Home
  • SEARCH
  • 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 3499466
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:36:54+00:00 2026-05-18T12:36:54+00:00

There must be something Im missing in my understanding of how .NET’s authentication/authorization and

  • 0

There must be something Im missing in my understanding of how .NET’s authentication/authorization and login redirection system works. I have a page admin/default.aspx that is restricted to admin users, so I have for example :

<configuration>
  <system.web>
    <authorization>      
      <allow roles="admin" />      
      <deny users="*" />
    </authorization>
  </system.web>
</configuration>

When the user gets here, if he is not an admin, he gets redirected to the login page as specified in the web.config :

<authentication mode="Forms">
  <forms loginUrl="Login.aspx" name="someName" timeout="60" path="/">
  </forms>
</authentication>

with a return url (which looks like ReturnUrl=%2fAdmin%2fDefault.aspx). Now, if the user logs in again with credentials that do not match the “admin” role specification, he gets redirected to the admin/default page and then back to the login page again.

I guess its all working fine, but it would seem that I could redirect to the login page if a user is not logged in, but redirect him to another (home or default) page if he’s logged in but doesn’t fit the role requirements.

How might I go about doing this?

Thanks in advance,

Rusty

  • 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-18T12:36:55+00:00Added an answer on May 18, 2026 at 12:36 pm

    You can do this a couple of ways:

    1. Write a custom authentication provider derived from the forms provider.

    2. Write a HttpModule, I’m not sure which event would be best to trap, as before authentication you dont have a role, after authentication the forms authentication module will already be redirecting you to the login page. so identifying the redirect response in the later events may be the way to go. (this may have the ancillary effect that all redirections to the logon page for an authenticated user would go to the logged on users ‘home’ page)

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

Sidebar

Related Questions

There must be something I'm missing here. I have this nice, pretty Oracle SQL
I think there must be something subtle going on here that I don't know
I'm having trouble using newly installed gems - I think there must be something
Obviously I can do and DateTime.Now.After - DateTime.Now.Before but there must be something more
I know websphere does it, so there must be something that lets apache figure
I thought what I wanted would be pretty simple, but there must be something
I assume there must be a system and language independent way to just stick
There must be something obvious that I'm doing wrong, but I'm not seeing it.
I must be missing something stupid here but I can not see it. My
I must be missing something. f = open(e, r) total = os.path.getsize(e) for line

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.