I have the test1.aspx and test2.aspx. A button contains in the test1 page. I make the code when the button clicks, the test2 page is transferred by using "server.transfer" method. So, we will see the test2 page in the browser and test1 page address in the address bar of browser. But if I do refresh button of the browser, the button of the test1.aspx works again. All browser happen like this. I want to refresh the test2.aspx page. How can I do this. I want to know how to work browser refresh button and use server.transfer.
Asked
Active
Viewed 606 times
1 Answers
2
You should use Response.Redirect()
instead. This will update the address bar and add it to the Browser History. Server.Transfer() can happen without the browser knowing about it. The browser might request a page, but the server can return the content of another. See this question.
EDIT
You can also use javascript in the OnClientClick of your button to do the navigation:
<asp:button id="Button1"
text="Go To Test2"
onclientclick="javascript:window.location.href = 'test2.aspx'""/>

Community
- 1
- 1

Edwin de Koning
- 14,209
- 7
- 56
- 74
-
I want to use server.transfer. So, have you get another way e.g. using js. – zanhtet Aug 29 '11 at 10:03
-
1Why exactly do you want to use server.transfer? – Edwin de Koning Aug 29 '11 at 10:05