我想知道如何在提交表单后重定向到确认/感谢页面。这是一个非常简单的查询表 - 只收集姓名,电子邮件,电话号码和问题。我尝试使用Redirect.response,但它给了我一个错误信息。我不确定放置它的正确位置。
这是我的脚本代码:
<%@ Page Language="VB" Debug="true" %>
<% @Import Namespace="System.Web.Mail" %>
<script language="vb" runat="server">
Sub Send2Mail (sender as Object, e as EventArgs)
Dim objMail as New MailMessage()
objMail.To = "me@myemail.com"
objMail.From = strEmail.Text
objMail.BodyFormat = MailFormat.Text
objMail.Priority = MailPriority.Normal
objMail.Body = "Name : " + strName.Text + vbNewLine + "Email : " + strEmail.text + vbnewLine + "Message : " + strQuestion.text
SmtpMail.SmtpServer = "email.myemailserver.net"
SmtpMail.Send(objMail)
strQuestion.Visible = true
End Sub
</script>
表格代码:
<form runat="server"><br />
Name:
<asp:textbox id="strName" runat="server" />
<br><br>
Email:
<asp:textbox id="strEmail" runat="server" />
<br><br>
Phone:
<asp:textbox id="strPhone" runat="server" />
<br><br>
Question:
<asp:textbox id="strQuestion" runat="server" Columns="16" Rows="5" TextMode="MultiLine" />
<p align="center">
<asp:button runat="server" id="func" Text="Send Message"
OnClick="Send2Mail" />
</p>
</form>