You would use return a FileStreamResult
in your action method instead of a handler.
public ActionResult GetFile()
{
using (FileStream stream = new FileStream())
{
FileStreamResult result = new FileStreamResult(stream, "image/jpg");
result.FileDownloadName = "image.jpg";
return result;
}
}
You could implement some resizing logic in the action.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…