画像ギャラリーがあり、次の方法で画像をレンダリングしています
<a href="/Gallery/GetImage?Name=sample.jpg>Imagename</a> //user clicks hyperlink to download file
<img src=""/Gallery/GetImage?Name=sample.jpg"> //Displaying the image
私のGetImage()関数は、画像を取得して返す場所の下にあります。
public ActionResult GetImage(string Name)
{
..
...
return File(FilePath, Type, Name); //Filepath - server folder where image located
//Name is File name
}
これはセキュリティ違反ですか。エラーは、ファイルを返す行に表示されます。
これを処理できるより良い方法はありますか?
この違反を回避するにはどうすればよいですか?
どんな提案でも大歓迎です
ありがとう