public MimePartFileStreamResult(IContentObject contentObject, string contentType) : base(new MemoryStream(), contentType) { tempFilePath = Path.GetTempFileName(); using (var tempFile = File.OpenWrite(tempFilePath)) { contentObject.DecodeTo(tempFile); } this.FileStream.Dispose(); this.FileStream = File.OpenRead(tempFilePath); }
public MimePartResponseMessage(HttpRequestMessage requestMessage, IContentObject contentObject) { tempFilePath = Path.GetTempFileName(); RequestMessage = requestMessage; using (var tempFile = File.OpenWrite(tempFilePath)) { contentObject.DecodeTo(tempFile); } Content = new StreamContent(File.OpenRead(tempFilePath)); }