下载文件类的问题 [英] problem with the downloading file class

查看:86
本文介绍了下载文件类的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好。



我已经为Download语句创建了一个类,如下所示,但是当下载完成后,下载的文件无效并且已损坏,那么是什么这堂课有什么问题吗?



hello.

I have made a class for the Download statement as below, but when download completes the downloaded file is not working and is corrupted, what is the problem in this class?

public class DownLoad
{
    public static void FileDownLoad(string URL)
    {
        WebClient Request = new WebClient();
        HttpResponse Response = HttpContext.Current.Response;
        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.Buffer = true;
        Response.AddHeader("Content-Disposition", "attachment;filename=\"" +URL +"\"");
        byte[] data = Request.DownloadData(URL);
        Response.BinaryWrite(data);
        Response.End();
    }
}

推荐答案

像代理一样制作代理要困难一些,但是不要太多。

我建议你从这个实现开始: http://kiwigis.blogspot.hu/2011/08/how-to-create-simple-proxy-in-aspnet.html [ ^ ]
Making a proxy like thing is a little more difficult, but not too much.
I suggest you start from this implementation: http://kiwigis.blogspot.hu/2011/08/how-to-create-simple-proxy-in-aspnet.html[^]


这篇关于下载文件类的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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