>Hi,
>
>I need to redirect (from code behind) to a previous page (as if user were to click on Back in the browser). I found online the following snippet of code:
>
>
>string navigateurl;
>navigateurl = "javascript:history.go(-1)";
>
>
>But when I do
>
>Response.Redirect(navigateurl, true);
>
>
>It does not work. The value in navigateurl does not look at all like the previous .aspx page. Do you see my mistake in the above code or do you have another suggestion on how to accomplish this task?
>TIA
>
>UPDATE:
>Found a different approach (which works):
>Store the url in the Page_Load method:
>
>Session["PreviousPageUrl"] = Request.UrlReferrer.ToString();
>
>The only question I have is if it is better to store this value to a session or a hidden control on the page. The session - if I understand correctly - could expire. And this could cause a problem. The hidden control is more "permanent"
Your initial code was javascript for the browser not the server.
For the server probably best to use a hidden control (I posted some code on a thread here a few days ago - don't know if I can find it now)