开发者

How to use server path to access a file for attachment

开发者 https://www.devze.com 2023-01-17 07:06 出处:网络
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 appl

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号