如何在ASP.NET中实现AJAX文件下载 [英] How to implement a file download in ASP.NET AJAX

查看:138
本文介绍了如何在ASP.NET中实现AJAX文件下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用标准的ASP.NET文件下载的反应,像的在其他堆栈溢出问题

I would like to use standard ASP.NET file download response, like in other Stack Overflow question.

Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition","attachment; filename=logfile.txt");
Response.TransmitFile( Server.MapPath("~/logfile.txt") );
Response.End();

但更新面板里面不起作用。我要做的,我会得到一个文件,如果被触发更新面板内的下载事件?

But inside update panel it does not work. What I have to do, that I will get a file if the download event is triggered inside update panel?

推荐答案

好吧,我发现好的博客贴子上Encosia其描述这个ASP.NET AJAX的文件下载问题的解决方案。它的工作真的很好。

Well, I have found nice blog post on Encosia which describe solution of this ASP.NET AJAX file download problem. It work really nice.

<一个href=\"http://encosia.com/2007/02/23/ajax-file-downloads-and-iframes/\">http://encosia.com/2007/02/23/ajax-file-downloads-and-iframes/

这篇关于如何在ASP.NET中实现AJAX文件下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆