Navigating back to the previous webpage

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello!

I'm trying to figure out how to go back to the previous webpage without
using the code below since the directory structure is hardcoded. It should
work just like clicking the "Back" button on Internet Explorer.

private void Button5_Click(object sender, System.EventArgs e)
{
Response.Redirect("http://localhost/Directory1/Form1.aspx");
}
 
Luckily, from the client's perspective, you cannot access the client history
directly from the server side. To navigate the client's history you must
use a client side script along the lines of:

<script language=javascript>
function goBack() {
window.history.go(-1);
}
</script>

HTH

DalePres
MCAD, MCDBA, MCSE
 
Perhaps storing the user's last few URLs (on your website) in their session
state?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top