Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Command to Go to Previous Page
Message
De
21/03/2014 12:45:08
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01597036
Message ID:
01597064
Vues:
33
>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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform