Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
Redirecting to previous page in asp.net

I have a web form which contains a submit button which updates the database.

After clicking the button I need to display a message and go back to the previous page after 2 seconds.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Regardless on technologies you use, you can simply store "back link" in the URL as one of the GET parameters and then use this URL to redirect user back to the required page. For example, your link might look like this:

/action/send/?backlink=/path/to/previous/page/

Of course, this link should be URL encoded and will look like this:

/action/send/?backlink=%2Fpath%2Fto%2Fprevious%2Fpage%2F

You can also send this link using POST method, alongside with the query for the database you might send. After the link being passed to the backend, you can place this link as a destination for redirect on the page with the message you want to show. You can use redirect by <meta> tag in HTML document like this:

<meta http-equiv="refresh" content="5;url=/path/to/previous/page/" />
  • 5 — Delay, amount of seconds before refresh will be fired;
  • url=/path/to/previous/page/ — Path for redirection.

As another solution, you can write JavaScript code which will do the same thing. Minimal implementation will look like this:

<script>
  // Wait for page to load
  window.addEventListener('load', function() {
    // Set the timer for redirection
    setTimeout(
      function () {
        location.href = '/path/to/previous/page/';
      },
      // Amount of milliseconds before refresh triggered
      5000
    );
  });
</script>
about 4 years ago · Juan Pablo Isaza Report

0

Response.AppendHeader("Refresh", "2;url=page.aspx");

this works.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!