◀ Previous Next ▶ Up ▲


witpoko.com


ช่วยแก้ Error เมื่อส่ง mail แบบ Attach file หน่อยค่ะ

หาก Run ที่ Server จะไม่มี Error หรือปัญหาใดๆ แต่เมื่อ Run ที่เครื่อง User จะเกิด Error ดังนี้ค่ะ

Server Error in '/ipo' Application.
--------------------------------------------------------------------------------

Invalid mail attachment 'C:\My Documents\web_err.txt'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Invalid mail attachment 'C:\My Documents\web_err.txt'.

Source Error:


Line 21:         If (attachment1.PostedFile.ContentLength > 0 Or attachment2.PostedFile.ContentLength > 0 Or attachment3.PostedFile.ContentLength > 0 Or attachment4.PostedFile.ContentLength > 0 Or attachment5.PostedFile.ContentLength > 0) Then
Line 22:             If (attachment1.PostedFile.ContentLength > 0) Then
Line 23:                 Dim myMailAttachment As New MailAttachment(attachment1.PostedFile.FileName)
Line 24:                 myMail.Attachments.Add(myMailAttachment)
Line 25:             End If


Source File: C:\Inetpub\wwwroot\ipo\sendmail_ipo.aspx.vb    Line: 23

Stack Trace:


[HttpException (0x80004005): Invalid mail attachment 'C:\My Documents\web_err.txt'.]
  System.Web.Mail.MailAttachment.VerifyFile() +143
  System.Web.Mail.MailAttachment..ctor(String filename) +21
  sendmail_ipo.Button1_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\ipo\sendmail_ipo.aspx.vb:23
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
  System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
  System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


จากคุณ : muai_t -[ 21 พ.ย. 49 - 16:29:50 ]





กระทู้ยอดนิยม