2
我有我的asp.net VMC Web应用程序内的下列模型类: -无法引用Url.content我的模型视图模型类中
public static class HtmlHelperExtensions
{
public static string ImageOrDefault(this HtmlHelper helper, string filename)
{
var imagePath = uploadsDirectory + filename + ".png";
var imageSrc = File.Exists(HttpContext.Current.Server.MapPath(imagePath))
? imagePath : defaultImage;
return imageSrc;
}
private static string defaultImage = "/Content/uploads/virtual-data-center.png";
private static string uploadsDirectory = Url.Contnet("/Content/uploads/");
}
}
,但我无法引用Url.content
在我的最后一行的代码,虽然我已经包括了using System.Security.Policy;
工作得很好,非常感谢。 –