请教:文件下载问题<a href="a.aaa">下载1</a>显示下载对话框,<a href="a.txt">下载2</a>直接显示文件内容,如何让下载2也显示下载对话框?
希望给出详细语句。
谢谢!
希望给出详细语句。
谢谢!
解决方案 »
- 选择任意多个查询条件点击查询按钮根据查询条件显示查询内容
- 管理员日志记录急急急....
- 今天想知道 ASP 里面的RegularExpressionValidator 怎样控制汉字个数?
- 谁有infomix的SDK,因为要用在.net环境下,SDK需要FOR WINDOWS 2。9以上版本的。
- 如何在datagrid中增加超连接列呢?并为它增加事件呢?
- 大家帮帮忙
- 做文件下载代理,下载到一半出现“Thread was being aborted.”
- entity 如何为dbcontext运行时动态附加上一个dbset
- 这个功能是否无法实现?网页上有两个帧,在a帧中执行代码控制b帧,达到:IE标准栏中的“停止”按钮的功能。能否实现?
- 菜鸟问题:如何改变EditColumn的位置?
- 同时向两张表插入记录的事务怎么写啊?
- 求:.NET 2003(简体中文版)的CD1. (能下载给分)
麻烦的
Dim fileLocation As String
fileLocation = ConfigurationSettings.AppSettings("ServerPlanSheetFolder") & lnkDownload.Text
Response.Clear()
Response.ContentEncoding = System.Text.Encoding.GetEncoding("shift-jis")
Response.AddHeader("Content-Disposition", "attachment; filename=" & lnkDownload.Text)
Response.ContentType = "application/ms-excel"
Response.WriteFile(fileLocation)
Response.End()
{
FileInfo fi=new FileInfo(paths);
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
//Response.AppendHeader("Content-Disposition","attachment;filename=" + System.Web.HttpUtility.UrlEncode(CheckStringLength(Path.GetFileName(paths)),System.Text.Encoding.Default));
Response.AppendHeader("Content-Disposition","attachment;filename=" + System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(CheckStringLength(Path.GetFileName(paths)))));
Response.AppendHeader("Content-Length",fi.Length.ToString());
// Response.AppendHeader("Content-Type",fi.Extension.ToString());
Response.ContentType="application/octet-stream";
Response.WriteFile(paths);
Response.Flush();
Response.End();
}
else
{
Response.Write("<script langauge=javascript>alert('The file does not exist!');history.go(-1);</script>");
// msg.msgs("The file does not exist.");return;
}
FileInfo aFile=new FileInfo(fullName); Response.Clear();
Response.ClearHeaders();
Response.BufferOutput=false;
Response.ContentType="application/octet-stream";
Response.AppendHeader("Content-disposition","attachment;filename="+HttpUtility.UrlEncode(name,System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length",aFile.Length.ToString());
Response.WriteFile(fullName);
Response.Flush();
Response.End();
{
FileInfo fi=new FileInfo(paths);
Response.Clear();
Response.ClearHeaders();
Response.Buffer=false;
//Response.AppendHeader("Content-Disposition","attachment;filename=" + System.Web.HttpUtility.UrlEncode(CheckStringLength(Path.GetFileName(paths)),System.Text.Encoding.Default));
Response.AppendHeader("Content-Disposition","attachment;filename=" + System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(CheckStringLength(Path.GetFileName(paths)))));
Response.AppendHeader("Content-Length",fi.Length.ToString());
// Response.AppendHeader("Content-Type",fi.Extension.ToString());
Response.ContentType="application/octet-stream";
Response.WriteFile(paths);
Response.Flush();
Response.End();
}
else
{
Response.Write("<script langauge=javascript>alert('The file does not exist!');history.go(-1);</script>");
// msg.msgs("The file does not exist.");return;
}