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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:10:46+00:00 2026-05-28T01:10:46+00:00

i m relatively new to C# and ASP.NET and I am having trouble designing

  • 0

i m relatively new to C# and ASP.NET and I am having trouble designing an authentication system.

I have created a website where the user has to login, after which he can access various pages in this site. When the user clicks a logout link, he returns to the login page and is given the message “you have successfully logout.” Now how do I prevent the user from typing the URL of one of the internal pages, bypassing my authentication? While working with PHP, I used session_start() and ob_end_flush() at the beginning and the end of each page to control authentication. What is a similar model in ASP.NET?

Also how do I include a .cs file from app_code folder to a aspx.cs?

  • 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-28T01:10:46+00:00Added an answer on May 28, 2026 at 1:10 am

    Now how do i prevent re entry into the site by typing the url of the internal pages in the address bar.

    How are you actually tracking the authentication? Forms authentication? Windows authentication? Something custom? Essentially, what you need to do is have those pages check for a valid authentication token. If no such token exists, redirect to the login page or an error or something to that effect.

    You can do this by checking for authentication manually in the Page_Init method (which can access Session data, Cookies data, etc. where you’d store such a token), you can use various methods built-in, etc.

    The concept is the same as it was in PHP, the tooling is just a little different.

    While working with PHP i used session_start() and ob_end_flush() at the beginning and the end of each page…..What is it im supposed to use in c#?

    You don’t need to explicitly start/end session state in ASP.NET. Any code in the scope of the web application can access session state/values via System.Web.HttpContext.Current.Session. Any request coming from the same session will have this data associated with it.

    Also how do i include .cs file from app_code folder to a aspx.cs

    While in PHP you had to include files, in ASP.NET it’s compiled code so the file isn’t so important. What you need to reference is the namespace/class to use the code. For example…

    If you have the following in a file in App_Code:

    namespace MyApplicationCode
    {
        public class SomeCode
        {
            // stuff in the class
        }
    }
    

    Then from any code within the application you should be able to use it by it’s fully-qualified name (MyApplicationCode.SomeCode):

    var someVariable = new MyApplicationCode.SomeCode();
    

    Additionally, you can add a using statement in the header of the code file:

    using MyApplicationCode;
    

    And then access it directly:

    var someVariable = new SomeCode(); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm relatively new to ASP.NET MVC so I'm having a little trouble with this
I am relatively new to website design and specifically working in ASP.NET, i am
I am relatively new to ASP.NET programming, and web programming in general. We have
I am relatively new at using ASP.NET MVC, however I have got experience with
I am relatively new to ASP.NET MVC, and am very impressed with the clarity
I am relatively new to ASP.NET & C# I am creating a basic form
I am relatively new to ASP.NET so I do not know the usual practice
I am relatively new to asp.net environment. Recently working on a project, i discovered
I'm relatively new to ASP.NET and was wondering if anyone could shed some light
I am relatively new in C# and ASP.NET MVC. There is something unusual that

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.