下载路径的隐藏
string destFileName = @"C:\Documents and Settings\Administrator\桌面\新建 文本文档 (4).rar";
if (File.Exists(destFileName))
{
FileInfo fi = new FileInfo(destFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
//Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(Path.GetFileName(destFileName),System.Text.Encoding.Default));
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(Path.GetFileName(destFileName), System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length", fi.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(destFileName);
Response.Flush();
Response.End();
}
else
{
Response.Write("<script langauge=javascript>alert('文件不存在!');history.go(-1);</script>");
Response.End();
}