itzdielawn
New Member
I am writing an application that is supposed to send an email, with up to 3 attachments. It is just a really simple web form, with 3 FileUpload controls to browse the possible attachments.The application is deployed in a webfarm and of course runs on server-side.I managed to make it send the emails, but I am having problems with the attachments. Right now, I am using this procedure to attach the files:\[code\] if (fuAttatchment.HasFile) { fuAttatchment.SaveAs(Server.MapPath(fuAttatchment.FileName)); MyMessage.Attachments.Add(new System.Net.Mail.Attachment(Server.MapPath(fuAttatchment.FileName))); filesize += fuAttatchment.PostedFile.ContentLength; }\[/code\]The error I am getting once I submit, is the following:\[quote\] Send failure: System.UnauthorizedAccessException: Access to the path 'E:\Inetpub\IS\MSTicketRequest\wallpaper-3010.jpg' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode) at System.Web.HttpPostedFile.SaveAs(String filename) at System.Web.UI.WebControls.FileUpload.SaveAs(String filename) at MSTicketRequest.WebForm1.btnSubmit_Click(Object sender, EventArgs e) in C:\Users\ggruschka\Desktop\ggruschka\MSTicketRequest\MSTicketRequest\Default.aspx.cs:line 54 \[/quote\]I have not been able to figure out why is this happen, probably I am missing something regardin security policies or something like that.Thank you very much in advance for your help !