0

I created two forms in asp.net, there are test1.aspx and test2.aspx. The test1 page contains one submit button. If the user clicks this, I do transfer to the test2 page by using server.transfer method. In this situation, the browser will show the test2 page content but the address bar of the browser will show the test1 page location. When the user clicks the refresh button of the browser or F5, the test1 page is worked and the submit button is worked. I don't want to work this. I want to refresh the test2 page. How could I do that? I don't want to use response.redirect.

zanhtet
  • 2,040
  • 7
  • 33
  • 58
  • 2
    Why do you not want to use Response.Redirect? – Tim Aug 30 '11 at 06:42
  • Because of performance issue. – zanhtet Aug 30 '11 at 06:47
  • 1
    @zanhtet: What performance problem are you facing with Response.Redirect? – Heinzi Aug 30 '11 at 07:26
  • yes. I knew the server.transfer method is better than response.redirect. – zanhtet Aug 30 '11 at 07:47
  • 2
    @zanthet: server.transfer is **not** "better" than response.redirect. It is just another approach. Server.Transfer actually will redirect from page1 to page2 without letting the browser know that it does, whereas [Response.Redirect](http://msdn.microsoft.com/en-us/library/ms524309%28v=vs.90%29.aspx) will do the same but it let the browser know(via HTTP header) where the road will lead to. Actually the browser itself will do the redirect. Therefore it seems that this is what you actually want. – Tim Schmelter Aug 30 '11 at 11:00
  • @Tim Schmelter: Ok, I am understand about this. Thanks for all reply and other people. – zanhtet Aug 31 '11 at 03:09

2 Answers2

0

Use Response.Redirect instead. This will actually redirect to test2.aspx so refresh will refresh test2.aspx.

c0deNinja
  • 3,956
  • 1
  • 29
  • 45
  • Sorry, I forget it that I don't want to use response.redirect. – zanhtet Aug 30 '11 at 06:33
  • oh i see. how bout if you pass a parameter in the url with the server.transfer method and then if user refreshes you can check that parameter and do the necessary logic??? – c0deNinja Aug 30 '11 at 06:43
0

You will need to cache which page you last looked at (Session = Page2), so when Page1 reloads, it can look at the cache, decide it's in the wrong place and then server.transfer again.

However it might be worth reconsidering how this page works, have you considered using a single page and storing the page state in a hidden fields

spacemonkeys
  • 1,689
  • 5
  • 16
  • 29