asp.net 下载附件

protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["ID"] == null)
            return;

        string AttaID = Request.QueryString["ID"].ToString();
        string FileName = Request.QueryString["FileName"].ToString();
       
        byte[] filebyte = new WebClass.Errands().Customer_Atta_Get(AttaID);
        Response.Clear();
        Response.AppendHeader("Content-Disposition", "attachment;filename=" +Server.UrlEncode(FileName));
        Response.AppendHeader("Content-Length", filebyte.Length.ToString());
        Response.ContentType = "application/octet-stream";
        Response.OutputStream.Write(filebyte, 0, filebyte.Length);
        Response.End();
    } 

你可能感兴趣的:(object,String,null,asp.net,byte)