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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:59:27+00:00 2026-06-09T07:59:27+00:00

I created a new asp.net web application using the template that visual studio has.

  • 0

I created a new asp.net web application using the template that visual studio has. That type of project create a login out-of-the-box which I configured with the aspnet_regsql command to work with my database.

Now, when someone logs into the application, I need to know whether or not the login was sucessful, so I can save in Session[''] the user name among other things.

I was expecting to find a method that returns true or false but instead in the Login.aspx.cs is just the Page_Load method and I don’t understand how it works.

I tried associated a onclick method that get the value of the UserName control, but obviously, that only works when the user log in for the first time, if the user check “Remember me next time” it won’t work.

  • 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-09T07:59:30+00:00Added an answer on June 9, 2026 at 7:59 am

    The AuthenticateRequest event is raised when the user has been authenticated, however in this event you do not have access to the SessionState yet. Therefore, to save the Session you should consider the PostAcquireRequestState application event.

    ASP.NET Application Life Cycle Overview for IIS 7.0

    ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0

    For additional info:

    • AuthenticateRequest event

    Example:

    In global.asax

        void Application_PostAcquireRequestState(object sender, EventArgs e)
        {
            if (Context.Session != null)
            {
                Application.Lock();
                Session["user"] = User.Identity.Name;
                Application.UnLock();
            }
        }
    

    Additionally, if you are using the LoginControl, you can handle the LoggedIn event:

    ASPX

        <asp:Login runat="server" ID="login" DestinationPageUrl="~/Default.aspx" 
            FailureAction="RedirectToLoginPage"
            onloggedin="login_LoggedIn" ...>
         ....
    

    ASPX code behind

    protected void login_LoggedIn(object sender, EventArgs e)
    {
        // set the Session here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a new MVC2 project using the ASP.NET MVC2 Web Application, which
I am trying to create my first web application using ASP.NET. I've created new
In VS2008, I go to File/New/Project, select ASP.NET Web Application and create a new
I created a new ASP.NET website using Visual Web Developer 2008 Express edition and
I created a new ASP.net MVC Web Application project. Inside my application, I created
I have an ASP.NET Web Application project that I am using to host a
I am using VS 2008. I have created a new Asp.net web site project
We have created a web application, using ASP.NET, that allows users to upload documents
It's been a while since I've created a new ASP.NET web application. (I've been
I create a new ASP.NET Web API project. I then use nuget to pull

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.