URL(HTML)のコンテンツを画像(JPG)に変換するアクションを作成し、それを返しましたが、ブラウザはそれを表示する代わりにダウンロードしています。
画像は動的に生成されます。ハードディスクにはありません。
私のコードは次のとおりです。
[AllowAnonymous]
public FileResult URLToImage(string url)
{
// In some cases you might want to pull completely different URL that is not related to your application.
// You can do that by specifying full URL.
UrlAsImage urlImg = new UrlAsImage(url)
{
FileName = Guid.NewGuid().ToString() + ".jpg",
PageHeight = 630,
PageWidth = 1200
};
return File(urlImg.BuildFile(this.ControllerContext), "image/jpg", urlImg.FileName);
}
ダウンロードする代わりにブラウザで表示するにはどうすればよいですか?