HttpRequest获取文件流,HttpResponse输出文件流
HttpResponse输出文件: Response.Clear(); Response.ContentType = "application/octet-stream"; //通知浏览器下载文件而不是打开 Response.AddHeader("Content-Disposition", "attachment; filename=aaa.csv"); var sw = new StreamWriter(response.OutputStream); //cc.Write<CustomerData>(list, sw, csvFileDesc); sw.Flush(); sw.Close();
HttpRequest获取文件:
var sr = new StreamReader(request.InputStream);