我试图在MVC控制器中使用它之前查看文件是否存在:
string path = "content/image.jpg";
if (File.Exists(path))
{
//Other code
}
Run Code Online (Sandbox Code Playgroud)
该File
关键字以红色下划线,编译器显示错误:
System.Web.MVC.Controller.File(string, string, string)
是一种'方法',巫婆在给定的上下文中无效.
我如何File.Exists()
在控制器中使用?