关于文件下载、打开的问题~~~~~~~急!!!!!! asp.net vb编程在数据库中读取文件名添加到listbox中,如何在listbox中实现双击打开下载事件,事件触发后如何编写下载代码!!!!!!请高人指点!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 onclick:string strFileName = list.SelectedValue;fi = new System.IO.FileInfo(strFileName); Response.Clear(); Response.ClearHeaders(); Response.Buffer = false; //Response.Charset = "utf-8"; //Response.ContentEncoding = System.Text.Encoding.UTF8; Response.ContentType = ContentType; //Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fi.FullName, System.Text.Encoding.UTF8)); Response.AppendHeader("Content-Disposition", "attachment;filename=" + fi.Name); Response.AppendHeader("Content-Length", fi.Length.ToString()); Response.WriteFile(fi.FullName); Response.Flush(); Response.Close(); <ASP:LISTBOX id="ListBox1" ondblclick="javascript:GoDownLoad();" runat="server" Width="152px" Height="126px"> <ASP:LISTITEM Value="1">A</ASP:LISTITEM> <ASP:LISTITEM Value="2">b</ASP:LISTITEM> <ASP:LISTITEM Value="3">c</ASP:LISTITEM> </ASP:LISTBOX> <SCRIPT language="javascript"><!-- function GoDownLoad() { var url = "down.aspx?filename="+Form1.ListBox1.value; window.open(url); }//--></SCRIPT>然后,down.aspx就用lazyfish(呆呆虫) 的代码下载文件。 lazyfish(呆呆虫) 的代码不是vb的吧?怎么能在下载时先提示“下载、打开”呢? 如何从javascript向asp.net传递中文参数? 求教网页控件如何任意摆放 数据库加过密的,如何解密 一个有关于执行函数的很急的问题! 请问如何使用ASP.NET制作ASP网站的流量访问啊! 如何让html静态页面得到aspx页中的值 新建Web项目时,出的错误,请帮忙看看。 多表联合查询后填充DataSet。如何显示? asp.net网址转向的问题 StringBuilder中 字符串拼接问题 【Help】 密码怎么读出来?vb.net的formsauthentication的函数? 网站发布的问题
string strFileName = list.SelectedValue;fi = new System.IO.FileInfo(strFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
//Response.Charset = "utf-8";
//Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = ContentType;
//Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fi.FullName, System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Disposition", "attachment;filename=" + fi.Name);
Response.AppendHeader("Content-Length", fi.Length.ToString());
Response.WriteFile(fi.FullName);
Response.Flush();
Response.Close();
runat="server" Width="152px" Height="126px">
<ASP:LISTITEM Value="1">A</ASP:LISTITEM>
<ASP:LISTITEM Value="2">b</ASP:LISTITEM>
<ASP:LISTITEM Value="3">c</ASP:LISTITEM>
</ASP:LISTBOX>
<!--
function GoDownLoad()
{
var url = "down.aspx?filename="+Form1.ListBox1.value;
window.open(url);
}
//-->
</SCRIPT>
然后,down.aspx就用
lazyfish(呆呆虫) 的代码下载文件。