How to use server path to access a file for attachment
I am trying to access a file on another server from my application. Out of application, I am able to access the fil开发者_开发技巧es from windows explorer, but when I am using the same path in my application, I am getting the error "Could not find a part of the path F:\Unknown\ABC\DEF\MNO\Fren.jpg".
My code goes here..
String FilePath;
FilePath = Request.FilePath("\\\\ABC\\DEF\\MNO\\Fren.jpg");
System.Net.Mail.Attachment a = new System.Net.Mail.Attachment(FilePath);
what is the problem in my code?
Usually this is actually a permissions issue (not a file-not-found issue). Make sure that the account you are using for read access actually (like the IIS account, or ASPNET account, if this is done from within IIS) has permissions to read the file.
--Dave
精彩评论