Response.Redirect("C:/Report/123.doc");
这样貌似不行
如果这个word正文是在Vs 项目中是可以跳转的
b/s结构搞不了,你电脑存在这个路径别人不一定存在。。
fileRpath = "c:\\Report\\123.doc";
Response.ClearHeaders();
Response.Clear();
Response.Expires = 0;
Response.Buffer =true;
string name = System.IO.Path.GetFileName(fileRpath);
System.IO.FileStream files = new FileStream(fileRpath, FileMode.Open, FileAccess.Read, FileShare.Read);
byte[] byteFile=null;
if (files.Length == 0)
{
byteFile=new byte[1];
}
else
{
byteFile = new byte[files.Length];
}
files.Read(byteFile, 0, (int)byteFile.Length);
files.Close();
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(name, System.Text.Encoding.UTF8));
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(byteFile);
Response.End();
把这段代码添加到你的pageload里