简体   繁体   中英

Redirect one vb.net page only?

In this link here: ASP.NET httpRedirect : redirect all pages except one

the poster asks how to redirect all pages except one. How would I do the opposite and only redirect one page, please? I have a Web contact form that is not redirecting to 'thankyou.aspx' after the user presses 'Send' (the form field data disappears but the form remains in place (contact.aspx remains in the address bar when it should redirect to thankyou.aspx).

There are no error messages and the SMTP code works, but it seems I may have a server 301 error on that contact.aspx page.

Thank you.

This is how I have done these things in the past.

In your contact form you have a button.

<asp:button id="btnSend" runat="server" OnSubmit="Send_Click"></button>

Then in your code behind

public void Send_Click(Object o, EventArgs e) {

// code to send the email

Response.Redirect("/thankyou.aspx");

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM