Click here to Skip to main content
16,011,608 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a HTTPS website (built in MVC .Net). I want to be able to load files hosted on the clients intranet. I have the full local paths to all the relevant files on the clients on their local infrastructure.

HTML
<pre lang="C#"><a href="file:///someShare:\1\RedlineForm.png">Link1</a>



The above code works when everything is local but when I do it remotely it wont work because its a security issue which is fine. However I'm looking a browser agnostic solution to getting around this limitation.

If its required my customers would allow me to install some service\application on local PCs to get this to work - however I'm unsure of what to use. Any help\advice would be appreciated.

A solution I considered was installing a small webapi on their infrastructure - then from my hosted site I call this api on the clients infrastructure to open the relevant file by passing it the path to the file.

What I have tried:

I've tried opening the file with href - which I dost work unless the request is made locally.

HTML
<pre lang="C#"><a href="file:///someShare:\1\RedlineForm.png">Link1</a>
Posted
Updated 25-Apr-16 4:07am
v2
Comments
Sergey Alexandrovich Kryukov 25-Apr-16 10:19am    
I don't think it's possible, due to security features of your HTTP server. Likewise, your server-side code cannot access any file beyond the root directory set up for your site. But if you serve up your LAN files via another site through HTTP/FTP, it will be possible to access them.
—SA
Richard Deeming 25-Apr-16 10:23am    
Can you get IIS running and serving up the files on the client's server? That way, you could link to the files over HTTP.
bsheehy 26-Apr-16 3:30am    
Richard - I may be able to get IIS installed on clients server. How then would I open a file on the client from my web-request? Would I install a Web API on the clients IIS infrastructure and call it from javascript to return the file. So method would be:
1. WebRequest - contains file path to open and address of local WebApi installed on clients infrastructure.
2. Javascript on Client calls local WebApi using WebApi address and file path from step 1.
Richard Deeming 26-Apr-16 7:04am    
No; you'd just replace the file: links with http: links.

Instead of:
file:///someShare:\1\RedLineForm.png

you'd have:
http://server/virtual_dir/path/RedLineForm.png

If you wanted to display the images in-line, you'd obviously need to add an SSL cert to the client's IIS site. You could probably get away with a free cert from Let’s Encrypt[^] or StartSSL[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900