坚持浏览器的pdf视图
问题描述:
hii,
i在浏览器的pdf视图中,同时提供物理服务器的路径
我尝试过:
hii,
i am stuck in pdf view on browser while giving the path of physical server
What I have tried:
my code is
<pre>string FilePath = "~/pdfs/channel-hw list.pdf";
string embed = "<object data=\"{0}\" type=\"application/pdf\" width=\"900px\" height=\"600px\">";
ltEmbed.Text = string.Format(embed, ResolveClientUrl(FilePath));
i想把文件路径作为物理服务器地址(例如\\servername\foldername\filename.pdf)。但它没有显示任何结果
i want to put filepath as physical server address(e.g. \\servername\foldername\filename.pdf). but it not showing any result
答
尝试使用 Server.MapPath方法 [ ^ ]
try using Server.MapPath Method[^]
string folder = Server.MapPath("pdfs");
string filePath = System.IO.Path.Combine(folder, "channel-hw list.pdf");
string embed = "<object data=\"{0}\" type=\"application/pdf\" width=\"900px\" height=\"600px\">";
ltEmbed.Text = string.Format(embed, filePath);