M
M1iS
I have a scenario where a file is posted to page from a desktop application.
Once the upload completes successfully the application calls a web service
and submits other information to a database regarding the file that was
uploaded and then sends out an email that is supposed to have the file that
was just previously uploaded added as an attachment. When I test this on my
development machine with IIS 7 everything works fine. However when I publish
the site and try this on our production server which is running IIS 6 I get
the following error:
Could not find file 'someFilePath'.
Stack Trace: 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)
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, FileAccess
access, FileShare share)
at System.Net.Mail.AttachmentBase.SetContentFromFile(String fileName,
String mediaType)
at System.Net.Mail.Attachment..ctor(String fileName, String mediaType)
at SiteUtility.SendEmailWithAttachment(String toEmail, String subject,
String body, Boolean isHtml, String attachmentFullName, String
attachmentMimeType) in someCodeFile:line 153
In my upload page code behind I save the file to disk using the following:
HttpPostedFile upload = Request.Files[0];
upload.SaveAs(uploadFullName);
Could it be that the HttpPostedFile object is locking up the file? Is there
a better way I could do it by using the HttpPostedFile object’s InputStream
property in a using statement or something along those lines?
Scott
Once the upload completes successfully the application calls a web service
and submits other information to a database regarding the file that was
uploaded and then sends out an email that is supposed to have the file that
was just previously uploaded added as an attachment. When I test this on my
development machine with IIS 7 everything works fine. However when I publish
the site and try this on our production server which is running IIS 6 I get
the following error:
Could not find file 'someFilePath'.
Stack Trace: 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)
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, FileAccess
access, FileShare share)
at System.Net.Mail.AttachmentBase.SetContentFromFile(String fileName,
String mediaType)
at System.Net.Mail.Attachment..ctor(String fileName, String mediaType)
at SiteUtility.SendEmailWithAttachment(String toEmail, String subject,
String body, Boolean isHtml, String attachmentFullName, String
attachmentMimeType) in someCodeFile:line 153
In my upload page code behind I save the file to disk using the following:
HttpPostedFile upload = Request.Files[0];
upload.SaveAs(uploadFullName);
Could it be that the HttpPostedFile object is locking up the file? Is there
a better way I could do it by using the HttpPostedFile object’s InputStream
property in a using statement or something along those lines?
Scott