その場でサムネイルを作成するこのアクションメソッドがあります:
public ActionResult Thumbnail(int imageId, int width, int height)
{
Image image = ImageManager.GetImage(imageId);
string thumbnailPath;
if (image.HasThumbnail(width, height))
{
thumbnailPath = image.GetThumbnailPath(width, height);
}
else
{
thumbnailPath = image.CreateThumbnail(width, height);
}
/*
Here, I've done the business of thumbnail creation,
now since it's only a static resource, I want to let IIS serve it.
What should I do? Using HttpContext.RewritePaht() doesn't work, as
I have to return an ActionResult here.
*/
return File(image.GetThumbnailPath(width, height), image.MimeType);
}
このメソッドを呼び出す URL の例は次のとおりです。
/create-thumbnail/300x200/for-image/34
しかし、この方法でサムネイル作成業務を行った後は、IIS にサムネイルを提供させたいと考えています。私は何をすべきか?コントロールを IIS に戻すにはどうすればよいですか?