后台http请求

HttpResponse response = HttpContext.Current.Response;
response.Buffer = true;
response.Clear();
response.ClearContent();
response.AddHeader("Content-Disposeition",string.Format(attachment;filename="+HttpUtility.UrlEncode(excelname,Encoding.UTF8).ToString()+".xls",DateTime.Now.ToString("yyyyy")));
response.ContentType = "application/ms-execl";
response.ContentEncoding = System.Text.Encoding.UTF8;
response.Charset="GB2312";
response.BinaryWrite(bytes);
response..Flush();
response.Close();

 

posted @ 2022-08-08 16:32  zwbsoft  阅读(46)  评论(0编辑  收藏  举报