Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 06, 2010 03:59 AM by Warren Machanik
Feb 05, 2010 02:47 PM|LINK
Hi, I have a form where a user asks for a quote and we need to send an attached application form. all this worked in the dev environment but when I post the changes onto our hosted server (third party ISP) I get an error when the attachment is added. I have
tired to use URL's but that does not work, at the moment I am using a relative path, but have also tried to place the file in the forms page folder.
Here is my attachment code:
string strFullPath = System.Web.HttpContext.Current.Server.MapPath(pRelativePath);
Attachment myAttachment = new Attachment(strFullPath, System.Net.Mime.MediaTypeNames.Application.Pdf);
this is in a try - catch block and I get the error "Could not find file".
mail attachment asp.net c#
Feb 05, 2010 03:13 PM|LINK
This might be obvious but.... it cant find the file [:)]
Try checking the value of strFullPath to make sure it has resolved correctly.
Have you checked pRelativePath is a proper path?
Feb 06, 2010 03:59 AM|LINK
, oops. I have a batch file that posts the latest files to the site, and the batch file did not cater for
pdf files LOL. When I ftp'd onto the site I find you were right.
Thanks, explains why I could not find an article that could help lol.