finding previous page

V

venky

Hi,

I have a question regarding page navigation. See i have a page called
page1.aspx and page2.aspx. On some event in the both the pages the page
get transfered to page3.aspx using Server.Transfer method.


One i i hit the update button in the page3, i want to go back to the
previous page which can be either page1 or page2.

How do i transfer back to previous page?


venky
 
R

Rajesh C K R

I am not sure about this. But, worth a try..

Would Request["HTTP_REFERER"] help?


Raj
 
B

Brock Allen

If you're using Server.Transfer you don't have an explicit way to get the
previous page. You can use the HttpContext.Items collection to implicitly
pass data to the second page (including a reference to the previous page):

// page1:
void ButtonClick()
{
Context.Items["PreviousPage"] = this;
Server.Transfer("Page2");
}

// page2:
void Page_Load()
{
page1_aspx prev = (page1_aspx)Context.Items["PreviousPage"];
prev.GetSomeStuff();
}

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
V

Vishnu-Chivukula

Hi Venkat,
There is no direct way to go back the previous page..
You can go back to the page A(which has called the page B) by using
Querystring or again use the Server.Transfer method...

To know which page has called the Page B, save the information in the
Session.

If there are too many variables to pass / confidential information then
Querystring might not be a good idea...

HTH,

Happy Coding
 

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

Top