Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Command to Go to Previous Page
Message
From
21/03/2014 12:45:08
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01597036
Message ID:
01597064
Views:
32
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform