Redirect from asp.net page

In asp.net 3.5 using vb I would like to navigate to another page in my application when the user clicks a button. what is the command for this?

thanks

0


a source to share


4 answers


Response.Redirect("url")

      



+3


a source


As mentioned in TheTXI, Response.Redirect

will work fine.

However, the button click code won't work until the end of the page's lifecycle. It might be that additional or unnecessary work might be required on your server. If that's the only thing you're doing, just wrap the button in an anchor tag:



<a href="url"><asp:button .../></a>

      

+1


a source


Here's an example on how this will happen

 Public Sub Click (ByVal sender As Object, ByVal e As System.EventArgs)
     Response.Redirect(SelectedItem.Text)
 End Sub

      

+1


a source


server.Transfer ("url", true) is much better to use as it hides the variables you want to transfer, if any.

0


a source







All Articles