// Copyright Epic Games, Inc. All Rights Reserved. using System.Net.Mime; using Microsoft.AspNetCore.Mvc; namespace HordeServer.Utilities { /// /// Class to return a file stream without the "content-disposition: attachment" header /// public class InlineFileStreamResult : FileStreamResult { /// /// The suggested download filename /// readonly string _fileName; /// /// Constructor /// public InlineFileStreamResult(System.IO.Stream stream, string mimeType, string fileName) : base(stream, mimeType) { _fileName = fileName; } /// public override Task ExecuteResultAsync(ActionContext context) { ContentDisposition contentDisposition = new ContentDisposition(); contentDisposition.Inline = true; contentDisposition.FileName = _fileName; context.HttpContext.Response.Headers["Content-Disposition"] = contentDisposition.ToString(); return base.ExecuteResultAsync(context); } } }