I have this action method which creates thumbnails on the fly:
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);
}
And and example of the URL that invokes this method is:
/create-thumbnail/300x200/for-image/34
However, after doing thumbnail creation business in this method, I want to let IIS serve the thumbnail. What should I do? How can I return the control back to IIS?