-2
嗨我创建了一个web api应用程序,并且我将响应作为文本文件返回。现在我想回到一个压缩文件,使其尺寸减小在Web Api中返回Zip文件作为响应
这是我的控制器代码
public HttpResponseMessage Get(String parameter)
{
var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StringContent(informationcontext.Records(parameter));
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/plain");
response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
{
FileName = "sample"
};
return response;
}
任何一个可以帮助我在这?
http://stackoverflow.com/questions/22176147/how-to-send-zip-files-to-asp-net-webapi – mittmemo
的可能重复看这个吗? :http://stackoverflow.com/questions/14573915/using-asp-net-web-api-how-can-a-controller-return-a-collection-of-streamed-imag –
可能重复的[我如何使用C#压缩文件,不使用第三方API?](http://stackoverflow.com/questions/940582/how-do-i-zip-a-file-in-c-using-no-3rd-party -蜜蜂) – Liam