关于文件下载的一个问题,麻烦各位帮忙! 我是用<a href='<%# Eval("LoadUrl") %>' target="_blank" class="lj22">下载</a>这种形式,但是现在的问题是,如果是rar的形式,可以直接下载;但是如果是txt他就直接在页面中打开,我想所有形式的都让它下载,该怎么办? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 写在后台代码里吧Response.Clear(); Response.ClearHeaders(); Response.BufferOutput = true; Response.ContentType = "application/ms-excel"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.AppendHeader("Content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(strNowTime + this.rps_session.User.Name + ".xls", Encoding.UTF8)); Response.WriteFile( StrFilePath ); Response.Flush(); Response.End(); 写在后台代码里吧 ?---------------写在page_load里面? 但是如果是txt他就直接在页面中打开。默认是直接打开txt类型文件 StrFilePathstrNowTime this.rps_session.User.Name + ".xls",是什么东西? 资源管理器-工具-文件类型-txt-高级-下载后证实打开前对勾勾上 请赐教 关于生成编号的问题 麻烦的SQL语句 用IE浏览aspx文件显示的全是源码,请问这是怎么回事? FreeTextBox imgaeGallery 未将对象引用添加到对象实例 asp.net的center用如何标记代替 高手指点 怎么做.cs文件编译成DLL文件后网页又可以正常浏览? 有关“热门搜索”问题 天下第一讨厌事:我现在的系统中老是出现: Windows Installer安装 Microsoft Office 2000 Premium 提示! 高分求javascript函数,最好是.js文件,里面包括的函数越详尽越好! Sql储存过程怎么会出错!!在线等.....
Response.Clear();
Response.ClearHeaders();
Response.BufferOutput = true;
Response.ContentType = "application/ms-excel";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.AppendHeader("Content-disposition", "attachment;filename=" + HttpUtility.UrlEncode(strNowTime + this.rps_session.User.Name + ".xls", Encoding.UTF8));
Response.WriteFile( StrFilePath );
Response.Flush(); Response.End();
---------------
写在page_load里面?
默认是直接打开txt类型文件
strNowTime
this.rps_session.User.Name + ".xls",
是什么东西?