According to your description, I couldn't understand your issue clearly.
As your codes, you have add a hyperlink in the mail body.
Do you mean you couldn't open the image from hyperlink in the browser?
If this is your issue, I suggest you could firstly check the hyperlink url.
Best Regards,
Brando
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
But it works if I manually open the link from other tab
Correct, it is certainly fine to open a file in the browser directly.
As you have experienced, the browser will not open a file share when the ink is not from originating URL. Basically the web browser will not allow a web server to select local resources as it creates a security vulnerability.
Member
3 Points
9 Posts
hyperlink with Network file share path not opening from browser
Apr 15, 2018 11:37 PM|OnlineUser|LINK
I have a hyperlink in mail body whose href is network file path ex: \\serverName\\path\\file.pdf
I am sending as
var url = "file:/// \\serverName\\path\\file.pdf"
mail.Body = string.Format("<a href='{0}'>View Image</a>", url);
mail.IsBodyHtml = true;
It works fine from outlook on my desktop but when I open mail from browser it does not work. How to resolve this
All-Star
52101 Points
23237 Posts
Re: hyperlink with Network file share path not opening from browser
Apr 15, 2018 11:48 PM|mgebhard|LINK
It is not possible as your browser will not allow access to resources like a file shares.
Member
3 Points
9 Posts
Re: hyperlink with Network file share path not opening from browser
Apr 16, 2018 12:33 AM|OnlineUser|LINK
But it works if I manually open the link from other tab
Star
9831 Points
3120 Posts
Re: hyperlink with Network file share path not opening from browser
Apr 16, 2018 09:04 AM|Brando ZWZ|LINK
Hi OnlineUser,
According to your description, I couldn't understand your issue clearly.
As your codes, you have add a hyperlink in the mail body.
Do you mean you couldn't open the image from hyperlink in the browser?
If this is your issue, I suggest you could firstly check the hyperlink url.
Best Regards,
Brando
All-Star
52101 Points
23237 Posts
Re: hyperlink with Network file share path not opening from browser
Apr 16, 2018 10:14 AM|mgebhard|LINK
Correct, it is certainly fine to open a file in the browser directly.
As you have experienced, the browser will not open a file share when the ink is not from originating URL. Basically the web browser will not allow a web server to select local resources as it creates a security vulnerability.