简体   繁体   English

仅重定向一个vb.net页面?

[英]Redirect one vb.net page only?

In this link here: ASP.NET httpRedirect : redirect all pages except one 在此链接中: ASP.NET httpRedirect:重定向除一个页面之外的所有页面

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). 我有一个Web联系人表单,在用户按下“发送”后,该表单没有重定向到“ thankyou.aspx”(表单字段数据消失,但表单仍然存在(当应重定向到thankyou时,contact.aspx保留在地址栏中) .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. 没有错误消息,并且SMTP代码有效,但是似乎我在该contact.aspx页上可能有服务器301错误。

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");

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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