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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:12:09+00:00 2026-05-11T03:12:09+00:00

I am working with asp.net website project that some of pages need authentication. I

  • 0

I am working with asp.net website project that some of pages need authentication. I am using asp.net membership.

I read some answers. e.g. make all of those pages in folder and create inner web.config that describe the privilege. This is one way solve the problem but I need way that is more fixable and effective.

  • 1 1 Answer
  • 3 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. 2026-05-11T03:12:09+00:00Added an answer on May 11, 2026 at 3:12 am

    If you don’t want to hard code this in web.config(s) you will need to implement a ‘Base Page’ type control.

    Your base page class should inherit from System.Web.UI.Page, and would need to have a method you could call to say ‘User must be logged in’ or ‘User must be in role x’, and if the user isn’t in that role, redirect to the login page (you can get this by calling FormsAuthentication.LoginUrl).

    Your actual pages should inherit from this class rather than from System.Web.UI.Page directly. Then, in something like Init, or at the top of Page_Load, call

    base.UserMustBeLoggedIn(); 

    or

    // Replace 'AccessRole' with the name of your role base.UserMustBeInRole('AccessRole'); 

    And let the base page handle this.

    If you would rather have the access rights stored in a database, then you could move all the processing to the base page, and in a suitable place in the page lifecycle, check the current URL against your database table, check the users role/authentication against the requirements and redirect as required.


    Note that you can create page level security in the web config like so:

    <configuration>   <location path='LockedPage.aspx'>     <system.web>       <authorization>         <!-- Deny access to anonymous users -->         <deny users='?'/>       </authorization>     </system.web>   </location> </configuration> 

    More information is available on MSDN: The Location Element and The Authorization Element.

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

Sidebar

Related Questions

I've got this ASP.NET 2.0 website project in Visual Studio that I've been working
I'm working on a ASP.NET website project using VB.NET as backend code. I was
I am working on ASP.NET 3.5 website project and using jQuery to warn users
I'm working on an ASP.NET website. To the solution I've added another project that
I have a ASP.net Web forms project that I am working on. I need
I'm currently working on an C#/ASP.NET project that will host several differents e-commerce websites,
I'm working on an ASP.Net project to display information on a website from a
I am working on an ASP.NET website with sql server 2008 R2. i need
I am using jquery in my asp.net website. It was working fine in my
I'm working with a intranet website written in ASP.NET and need to be able

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.