我有在飛行中產生縮略圖這個動作方法內返回回控制IIS:從ASP.NET MVC3操作方法
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);
}
而且和例子調用該方法的網址是:
/create-thumbnail/300x200/for-image/34
但是,在用這種方法做縮略圖創建業務後,我想讓IIS服務縮略圖。我該怎麼辦?我怎樣才能將控制權還給IIS?
究竟你將控制權返回給IIS服務的縮略圖是什麼意思?您希望用戶在訪問網址時看到文件下載提示? –
我希望IIS服務於該文件,而不是我返回一個'FileResult'。這似乎很清楚。 –