我的详细信息文件夹中有单词文件,我想在浏览器中显示该单词文件。它给了我不是有效的虚拟路径错误
string filename = "http://something.in/management/details/" + DS.Tables["Table"].Rows[0]["DETAILS"].ToString();
if (filename != "")
{
string path = Server.MapPath(filename);
System.IO.FileInfo file = new System.IO.FileInfo(path);
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/ms-word";
Response.WriteFile(file.FullName);
Response.End();
}
else
{
Response.Write("This file does not exist.");
}
}