Pregunta

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.

¿Fue útil?

Solución

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'""/>
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top