私は、ファイルがMVCコントローラで使用する前に存在しているかどうかを確認しようとしています:MVCコントローラでSystem.IO.Fileメソッドを使用できないのはなぜですか?
string path = "content/image.jpg";
if (File.Exists(path))
{
//Other code
}
File
キーワードが赤い下線、およびコンパイラがエラーを示している。
System.Web.MVC.Controller.File(string, string, string)
is a 'method', witch is not valid in the given context.
どのようにすることができます私はFile.Exists()
をコントローラに使用していますか?
すでに追加されています。 – Pomster
'System.IO.File.Exists(...) 'を使用してください –