public static FileContentResult FileResult( this Controller controller, byte[] fileContents, string contentType, string filename, bool isInLine) { if (isInLine) { controller.Response.Headers.Append("Content-Disposition", "inline; filename=" + filename.Replace(",", "")); return(controller.File(fileContents, contentType)); } else { return(controller.File(fileContents, contentType, filename)); } }