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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:47:44+00:00 2026-06-18T09:47:44+00:00

Is there a way I can restrict access to pages without the built in

  • 0

Is there a way I can restrict access to pages without the built in role based way?

Essentially if the user tries to access admin.aspx then it redirects to login.aspx&redirect_url=admin.aspx

\then, they will postback with their credentials and I will give them a session cookie and so forth.

Is there an example of this?

Thanks

Edit:

I cannot use the way ASP.NET does it because my database has employees with usernames and passwords. ASP creates its own with roles and such

  • 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-06-18T09:47:46+00:00Added an answer on June 18, 2026 at 9:47 am

    First, you should set a FormsAuthentication cookie on login. So, in your code, on successful login you can set the cookie with:

    FormsAuthentication.SetAuthCookie(theUsername, true); 
    

    or better yet, you can use this to handle the cookie and the redirect:

    FormsAuthentication.RedirectFromLoginPage(theUsername, true);
    

    (true if you want to cookie to persist)

    The you can secure the admin folder by putting a web.config file in that folder:

    <?xml version="1.0"?>
    <configuration>
        <system.web>
            <authorization>
                <allow users="adminusername1,adminusername2"/>
                <deny users="*"/>
            </authorization>
        </system.web>
    </configuration>
    

    Now when someone hits that admin folder and they aren’t logged in, it will automatically send them to login.aspx?ReturnUrl=admin.aspx

    Another thing to consider would be to implement your own RoleProvider. It’s a lot less daunting that you may think. If you need to put people into roles (like Admin), then this is a good idea.

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

Sidebar

Related Questions

Is there a way to restrict access to a website based on ssh keys?
Is there some way to restrict access to one our pages to only allow
I want to know if there is any way through which I can restrict
I have a folder with multiple .aspx pages that I want to restrict access
Example User jtirado is assigned role HR-Assistant, can access route mymvcapp/employeee/edit/1452 to edit employee
Is there a way to restrict access to a specific webpage such as http://www.example.com/subpage
I'm trying to build a middleware that can restrict access based on conditions. I
Is there any way can declare a bean in just like JSP UseBean in
Is there way that I can read the file from remote server using fopen
Is there any way I can set a formatter on models that will convert

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.