首先,我是一名php開發人員,大多數.net對我來說都是陌生的,這就是我在這裏發佈的原因!asp.net新手。需要幫助調試此電子郵件表格
我剛剛通過一個網站從一組網站遷移到另一個網站。整個網站都是用.net編寫的。沒有一個網站是數據庫驅動的,所以大部分工作,除了聯繫表格。網站上的輸出簡單說明出現錯誤:「出現錯誤 - 請嘗試再次提交聯繫表單,如果您仍然遇到問題,請通知我們的網站管理員。」這只是一個簡單的消息,它彈出它到達電子郵件功能的「catch」部分。
我走進web.config中,改變了參數:
<emailaddresses>
<add name="System" value="[email protected]"/>
<add name="Contact" value="[email protected]"/>
<add name="Info" value="[email protected]"/>
</emailaddresses>
<general>
<add name="WebSiteDomain" value="hoyespharmacy.com"/>
</general>
那麼對於接觸cs文件中包含的郵件功能EmailFormData():
private void EmailFormData()
{
try
{
StringBuilder body = new StringBuilder();
body.Append("Name" + ": " + txtName.Text + "\n\r");
body.Append("Phone" + ": " + txtPhone.Text + "\n\r");
body.Append("Email" + ": " + txtEmail.Text + "\n\r");
body.Append("Fax" + ": " + txtEmail.Text + "\n\r");
body.Append("Subject" + ": " + ddlSubject.SelectedValue + "\n\r");
body.Append("Message" + ": " + txtMessage.Text);
MailMessage mail = new MailMessage();
mail.IsBodyHtml = false;
mail.To.Add(new MailAddress(Settings.GetEmailAddress("System")));
mail.Subject = "Contact Us Form Submission";
mail.From = new MailAddress(Settings.GetEmailAddress("System"), Settings.WebSiteDomain);
mail.Body = body.ToString();
SmtpClient smtpcl = new SmtpClient();
smtpcl.Send(mail);
}
catch
{
Utilities.RedirectPermanently(Request.Url.AbsolutePath + "?messageSent=false");
}
}
如何看什麼實際的錯誤是。我想我可以做一些功能的「捕捉」部分..任何指針?
謝謝!
請注意您的問題,您不應該從catch塊重定向,以避免使用ftp作爲遠程源的ThreadAbortExceptions – 2010-03-29 17:38:26