我有这种动态创建缩略图的操作方法:
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?