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?
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>
";
您是否尝试过server.MapPath(“文件路径”)
your link is wrong patch, http or (localhost)?
you have not permission to access to out of server patch
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.