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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:01:20+00:00 2026-05-19T09:01:20+00:00

I am developing an ASP.NET website. There are some pages on my sit that

  • 0

I am developing an ASP.NET website. There are some pages on my sit that I want him to see only if he is a registered user. If not, he should be redirected to the appropriate page. Should I be checking this on the Page_load event that the user is logged in or not?

If the user types the name of the URL, this would still work, right?

  • 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-19T09:01:20+00:00Added an answer on May 19, 2026 at 9:01 am

    Here is what I do for some of simplest websites. It uses typical forms authentication. From global.ascx.cs:

    protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
    {
        var unsecuredPages = new[]
                                 {
                                     "test.htm",
                                     "email.htm"
                                 };
    
        bool letThrough = unsecuredPages.Any(s => Request.RawUrl.ToLowerInvariant().Contains(s));
        if (letThrough)
        {
            return;
        }
    
        if (!User.Identity.IsAuthenticated &&
            !Request.RawUrl.Contains(FormsAuthentication.LoginUrl))
        {
            FormsAuthentication.SignOut();
            FormsAuthentication.RedirectToLoginPage();
        }
    }
    

    You explicitly specify pages that should be visible to all users and all other requests will be redirected to the login page. My web.config looks something like this:

    <authentication mode="Forms">
        <forms loginUrl="Login.aspx" protection="All" timeout="480" name="xyz" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="Default.aspx" cookieless="UseDeviceProfile" enableCrossAppRedirects="true"/>
    </authentication>
    <location path="Styles">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a new website (ASP.Net, VB codebehind pages, .Net 3.5) to replace a
I am developing an ASP.Net application that will need to verify that the user
I'm developing a new ASP .NET website which is effectively a subset of the
Since, for various reasons, I can't use IIS for an ASP.NET website I'm developing,
I'm developing a website (using asp.net by the way) and I'm having a problem
I've been developing a simple website using asp.net MVC and I'm starting to add
We are developing large ASP.NET applications with lot of dynmically created pages containing ASCX
I'm developing an ASP.Net MVC site and on it I list some bookings from
I have been developing in asp.net since its existence (also classic asp before that)
I am developing a multilingual ASP.NET web site. I want the users to be

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.