Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/274.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 字符串被附加到Chrome中的图像源,从而阻止其加载_Javascript_C#_Asp.net_Umbraco - Fatal编程技术网

Javascript 字符串被附加到Chrome中的图像源,从而阻止其加载

Javascript 字符串被附加到Chrome中的图像源,从而阻止其加载,javascript,c#,asp.net,umbraco,Javascript,C#,Asp.net,Umbraco,我的代码看起来像 var publishedDate = Convert.ToDateTime(node.GetProperty("publishedDate").Value); string image = Umbraco.Content(node.Id).GetPropertyValue("postImage").src; string categories = @node.GetProperty("categories").Value.Replace(",", ", "); &l

我的代码看起来像

 var publishedDate = Convert.ToDateTime(node.GetProperty("publishedDate").Value);
 string image = Umbraco.Content(node.Id).GetPropertyValue("postImage").src;
 string categories = @node.GetProperty("categories").Value.Replace(",", ", ");

 <div class="column">
   <img class="post-image" src="@image">
   <div class="post-details" data-equalizer-watch>
     <h5 class="post-category">@categories</h5>
     <h2 class="post-title"><a href="@node.Url">@node.Name</a></h2>
     <h6 class="post-date">@string.Format("{0:MMMM dd, yyyy}", publishedDate)</h6>
   </div>
 </div>
jpg后面追加的字符串导致图像出错。这在Internet Explorer中不会发生,因为不会追加字符串。有人知道为什么会这样吗


谢谢,

根据您使用的Umbraco版本,我会得到如下媒体路径:

对于v7.6及以上版本

string imageUrl = Model.Content.GetPropertyValue<IPublishedContent>("headerImage").Url;
请参阅我的博客文章,了解如何从控制器执行此操作。

为什么你从一个
开始,然后到一个
然后再到一个
?不要使用标题进行格式设置。它们表示文档的各个部分。从
h1
开始,它们的顺序应该是连续的(每个级别)。您使用的是哪个版本的Umbraco?
string imageUrl = Model.Content.GetPropertyValue<IPublishedContent>("headerImage").Url;
UmbracoHelper uHelper = new UmbracoHelper(UmbracoContext.Current);
string mediaUrl = "";
if (CurrentPage.HasValue(propertyName))
{
    var mediaItem = uHelper.Media(CurrentPage.propertyName.ToString());
    mediaUrl = mediaItem.umbracoFile;
}
return mediaUrl;