views:

57

answers:

2

I am using an image button and on click of it i want to go to visited page. Now i am using - Response.Redirect(Request.UrlReferrer.ToString()), It is going to previous page, but when i am in a page of some user details where the link is looks like - users.aspx?userid=25 and i visit some other page and click back(image button) i want to see the same userdetail page. How to track that. Please Guide.

A: 

Hi there.

I would recommend using the Session object to store the url e.g.

Session("PreviousPage") = Request.Url.AbsolutePath // Or whatever....

You can then make use of the above in other pages to set the back button's url.

EDIT:

In response to your comment, are 100% sure you're saving the current url before moving to the next page?

Protected Sub btnNextPage()

    Session("PreviousPage") = Request.Url.AbsolutePath // Or whatever....
    Response.Redirect("nextpage.aspx")

End Sub

Cheers. Jas.

Jason Evans
No luck. Showing the same page. Actually i have placed that response.redirect in the master page.
Yajuvendra
A: 

Do you want your custom back button to always take the user to the same page as the browser's normal back button will? If so, you can use javascript to do that with something like

myBackButton.OnClientClick = "window.history.go(-1);return false;";
stevemegson
Thanks. But in some pages it is showing Web page Expired.
Yajuvendra