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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:34:45+00:00 2026-06-09T22:34:45+00:00

I have an old application which has numerous webforms. On every aspx page there

  • 0

I have an old application which has numerous webforms. On every aspx page there is a designated back button, which takes the user to the previous page. All the buttons have the javascript onclick event set to history.back().

On one of the aspx pages, the back button would not work at all. We decided to use a server side button that would accomplish the same thing. The onclick event of the button has the necessary code to take the user to previous page.

First I created the onclick event in the following way, but the back button did not work at all. When I went in the debug mode, I found that the prevPage variable was holding the current page URL instead of the previous page URL.

private void btnBack_Click(object sender, System.EventArgs e)
{
    string prevPage = Request.UrlReferrer.ToString();
    Response.Redirect(prevPage);
}

Then I changed the prevPage to a static variable and defined its value to be set inside the if(!IsPostBack) block. Now the back button worked correctly.

static string prevPage = string.Empty;
private void Page_Load(object sender, System.EventArgs e)
{
    if(!IsPostBack)
    {
        prevPage = Request.UrlReferrer.ToString();
    }
}

private void btnBack_Click()
{
    Response.Redirect(prevPage);
}

I did not understand why the first attempt wouldn’t work and why second attempt would.

I have a feeling that this might explain if there is something else going on with this particular page that would also not let the history.back() or history.go(-1) work.

Can you please provide some insight into this?

Edit: I am using IE8.

  • 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-09T22:34:47+00:00Added an answer on June 9, 2026 at 10:34 pm

    The first attempt would not work because when you click the button the post back has already occurred, therefore the Referrer URL is the one coming from the button (The page you are on).

    In my opinion I would not send a request to the server to push the page back a level, it’s an unnecessary request when it could be achieved quicker on the client side.

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

Sidebar

Related Questions

I have an old J2EE application (J2EE 1.3), which packages into an EAR, and
I have successfully upgraded an MFC application which was compiled with an old version
I have an application that is responsible for archiving old applications, which will do
I have a 3yr old application that has some controllers with some very unrestful
Retrofitting ASP.NET WebForms themes to an old application I have a need to theme
We have an old asp.net application that has no unit tests, integration tests, component
I have a java application which has a GUI in both English and French,
I have a asp.net web application which has a number of versions deployed on
I have an iPad application which has many categorized images I need to switch
I have an old C++ library which has been designed for use in single-threaded

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.