0
私はテスト用のコンソールアプリケーションで何かをしようとしています(WebアプリケーションのHttpHandlerのコードに基づいています)。 たのHttpContextがそれに合格した私のHttpHandlerのために働く以下のようなものを考えるとHttpHandlerがHttpcontext.Response.OutputStream.Writeでできることをストリームするために、System.Net.WebClientをコンソールアプリケーションで使用できますか?
:私はそれの一部を持っている
context.Response.AppendHeader("Content-Length", docContent.Length.ToString());
context.Response.AppendHeader("content-disposition", "attachment; filename=\"" + fileName + "\"");
context.Response.ContentType = MIMEType.MimeType(fileType);
context.Response.OutputStream.Write(docContent, 0, docContent.Length);
context.Response.OutputStream.Flush();
は、私は思うし、私は動けなくなる:
WebClient client = new WebClient();
client.Headers.Add("Content-Length", docContent.Length.ToString());
client.Headers.Add("content-disposition", "attachment; filename=\"" + fileName + "\"");
string ContentType = MIMEType.MimeType(fileType);
// ??
// how to build the response as an output stream from my byte array which has the data ?