如何在VS2015(DNX4.5.1)上实现从服务器下载文件
是这样的,我想从服务器上下载文件到客户端,查资料后发现基本都推荐以下
string fileName = "asd.txt";//客户端保存的文件名
string filePath = Server.MapPath("DownLoad/aaa.txt");//路径
FileInfo fileInfo = new FileInfo(filePath);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(fileInfo.FullName);
Response.Flush();
Response.End();
但是我在VS2015里没有发现Response,而发现HttpResponse里具有Response的各种功能,但是我不会使用HttpResponse,求教各位大神该如何使用HttpResponse