ASP.NET Button to redirect to another page
<button type ="button" onclick="location.href='@Url.Action("viewname","Controllername")'"> Button name</button>
for e.g ,
<button type="button" onclick="location.href='@Url.Action("register","Home")'">Register</button>
You can use PostBackUrl="~/Confirm.aspx"
For example:
In your .aspx file
<asp:Button ID="btnConfirm" runat="server" Text="Confirm"
PostBackUrl="~/Confirm.aspx" />
or in your .cs file
btnConfirm.PostBackUrl="~/Confirm.aspx"
u can use this:
protected void btnConfirm_Click(object sender, EventArgs e)
{
Response.Redirect("Confirm.aspx");
}
You can either do a Response.Redirect("YourPage.aspx");
or a Server.Transfer("YourPage.aspx");
on your button click event.
So it's gonna be like the following:
protected void btnConfirm_Click(object sender, EventArgs e)
{
Response.Redirect("YourPage.aspx");
//or
Server.Transfer("YourPage.aspx");
}