Reputation: 3751
In my server which I shared, to store some files and I can access it from the run command like this from my local PC:
\\myserver\myfolder\file.pdf
(which is technically on C:\myfolder\file.pdf
in the server itself)
I am trying to display a link on my ASP.net webpage, built using C#, so the user can click on it and download the file to their local PC. My partial code-behind is this:
string newFileServer = "//" + System.Environment.MachineName + @"/myfolder/file.pdf";
tc.Text = "A completed PDF for " + k + " was generated successfully and saved to <a href=" + newFileServer + ">" + newFileServer + "</a>";
When I hover over the link in my local PC, I see the following:
http://myserver/myfolder/file.pdf
When I click on it, I get a 404 File or directory not found
error.
How do I resolve it?
Upvotes: 1
Views: 1791
Reputation: 4659
Map the folder in IIS as a virtual directory and then set your path accordingly.
****** EDIT *******
tc.Text = "A completed PDF for " + k + " was generated successfully and saved to
<a href='/PDFGenerate/file.pdf'>file.pdf</a>
";
Upvotes: 1
Reputation: 376
your link is wrong patch, http or (localhost)?
you have not permission to access to out of server patch
Upvotes: 1