ASP.Net项目中的下载问题 [英] Download Problem in ASP.Net project
本文介绍了ASP.Net项目中的下载问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Remittance.Common;
using Remittance.DAL.Entities;
using Remittance.DAL.Repo;
using Remittance.DAL;
namespace Remittance.Payment
{
public partial class download : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
IQueryable<transaction> src= Session["SRC"]as IQueryable<transaction>;
string reportName = (string)Session["reportname"];
string extension = (string)Session["extension"];
byte[] bytes = (byte[])Session["Byte"];
Response.Clear();
// Response.ContentType = mimeType;
Session["Success"] = "Success";
Response.AddHeader("Content-Disposition", "attachment; filename=" + reportName + "." + extension);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.OutputStream.Write(bytes, 0, bytes.Length);
Response.Flush();
Response.End();
}
}
}
</transaction></transaction>
我用它在asp.net中下载文件,该文件在Mozilla,google chrome,IE9中起作用.
但不能在IE6、7、8中使用?为什么
如果您知道的话,请回答我.
感谢您的阅读.
[已编辑]代码包装在"pre"中[/已编辑]
I use this for download a file in asp.net, its work in Mozilla, google chrome, IE9
but don''t work in IE6,7,8?? why
please answer me if any of u know ?
Thanks for reading.
Code is wrapped in "pre"[/Edited]
推荐答案
^ ]
看看这个.
File Upload and Download in ASP.NET[^]
Have a look on this.
请参阅下面的链接,您可能会找到一种适合您的解决方案,
http://drupal.org/node/349134 [ http://answers.microsoft.com/zh-cn/ie/forum/ie8-windows_other/download-complete-box-no-longer-showing-in-ie8/b2f81412-b690-43f4-a4d8- 72c0da9c52ac [ http://aspalliance.com/259_downloading_files__forcing_the_file_download_dialog [ ^ ]
Hi,
see the links below, you may find one solution works for you,
http://drupal.org/node/349134[^]
http://answers.microsoft.com/en-us/ie/forum/ie8-windows_other/download-complete-box-no-longer-showing-in-ie8/b2f81412-b690-43f4-a4d8-72c0da9c52ac[^]
also for reference
http://aspalliance.com/259_downloading_files__forcing_the_file_download_dialog[^]
这篇关于ASP.Net项目中的下载问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文