goDaddy 메일 서버를 통해 메일을 보내려고합니다. 메일이 전송되는 경우 메일 (나는 내 메일 박스에 수신하고)하지만 catch 블록이 실행하고 쿼리 문자열 MSG와 연락처 페이지에 저를 방문 전송되는 'shouldn,try 블록이 예외를 throw하지 않더라도 catch 블록을 실행합니까?
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["username"] != null && Request.QueryString["email"] != null && Request.QueryString["msg"] != null)
{
try
{
string name = Request.QueryString[0];
string email = Request.QueryString[1];
string msg = Request.QueryString[2];
SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net", 25);
//smtp.EnableSsl = false;
smtp.Send("[email protected]", "[email protected]", "feedback", "Name:" + name + "\n e-mail:" + email + "\n Subject:" + msg);
Response.Redirect("contact.html?msg=success");
}
catch(Exception ex)
{
Response.Redirect("contact.html?msg=fail");
}
}
else
{
Response.Redirect("contact.html");
}
}
을 "실패" "contact.html? msg = success"로 리디렉션 하시겠습니까?
시작 디버거와 무슨 일이 일어나고 있는지보고 ...'원을 차단 catch' 예외가없는 경우 실행합니다. – opewix
일어난 일을 로깅하지 않고 예외를 잡는 것은 실제로 나쁜 습관입니다. Ex.Message (적어도) – Steve
예외 세부 사항을 공유하려고하면 Ex.message에서 예외 메시지가 나타납니다. –