2
У меня есть следующий класс модели в моем asp.net VMC веб-приложениях: -Невозможно ссылаться 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;
хорошо работает, спасибо большое. –