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

  • Home
  • SEARCH
  • 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 6987085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:53:29+00:00 2026-05-27T18:53:29+00:00

I have a master page with a logout link on it. When the user

  • 0

I have a master page with a logout link on it. When the user clicks the link I call the following method:

    private void Logout()
    {
        SessionBll.DeleteSessionEntry(this.sessionId);
        FormsAuthentication.SignOut();
        Roles.DeleteCookie();
        LogHelper.Location = string.Empty;

        LogHelper.Info(logger, HttpContext.Current.User.Identity.Name, 
           MethodBase.GetCurrentMethod().Name, "User has been logged out from 
                Administrator.Master", LogMessage.LoggedOut);
        FormsAuthentication.RedirectToLoginPage();
    }

Now, when a user is on a page and they click the link, the normal page cycle happens and this method is called.

The problem with this is that the user shouldn’t have to wait for the page cycle, they should be taken to the logout page as fast as possible (as long as it takes to run the logout method on the server).

How do I skip the page life cycle, yet still call this method?

Thanks.

  • 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-27T18:53:30+00:00Added an answer on May 27, 2026 at 6:53 pm

    You can’t skip the page life cycle; what you can do instead is this:

    Change that logout link to a normal link (<a href="...">) and on Page_Load of the Login page, execute that code you posted but only if(!IsPostBack)

    Edit

    If your Login page needs to know (as you put it) when to execute your cleanup code; you can pass a parameter on the logout link as so:

    <a href="Login.aspx?Logout=y" > Logout </a>
    

    And then check on Page_Load:

    if (!IsPostBack &&  Request.QueryString["Logout"]=="Y" )
    {
       //Your code here
    }
    

    This is super fast.

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

Sidebar

Related Questions

I have a master page, with a help link in the top menu. This
i have a logout [link button] in master page and i want to show
I have a master page, and this master page has the following code <%@
I have made a web application that uses master page for Login & Logout
I have a master page called SampleMaster.master and this page contains a Repeater control
I have a master page with tabs. The tabs are defined by the following
I have one master page which applies to all pages in this website. On
I have a master page in C#, where I have this code: <div style=width:
I have on master page four user controls which are binded to shared presenter.
i have master-content page scenario.I have a link button on content page. that redirects

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.