宏 – 加载MacroEngine脚本时出错(文件:LawyerProfileView.cshtml)

宏 – 加载MacroEngine脚本时出错(文件:LawyerProfileView.cshtml),第1张

概述在网站上工作我已经完成并且突然发生了几个宏开始播放.宏工作正常,现在突然出现这个错误,任何人都可以帮助这里是代码. @using umbraco.MacroEngines@inherits umbraco.MacroEngines.DynamicNodeContext @functions{ public void SetPageTitle(st 在网站上工作我已经完成并且突然发生了几个宏开始播放.宏工作正常,现在突然出现这个错误,任何人都可以帮助这里是代码.

@using umbraco.MacroEngines@inherits umbraco.MacroEngines.DynamicNodeContext          @functions{              public voID SetPageTitle(string Title)              {                  var page = httpContext.Current.Handler as Page;                  if (page != null){                      page.Title = Title;                  }              }              public DynamicNode Homepage              {                  get {                       var homepage = Model;                      while(homepage.NodeTypeAlias != "Homepage"){                          homepage = homepage.Parent;                      }                      return homepage;                  }              }              public HTMLString GetSocialMedialink(string network,string url,string name)              {                  var socialMediaRepo = library.NodeByID(-1).DescendantsOrSelf("SocialMediaNetworkRepository").First();                  var socialNetworks = new List<DynamicNode>();                  if (socialMediaRepo != null)                  {                      foreach (var child in socialMediaRepo.Children)                      {                          if(child.NodeTypeAlias.Tolower().Equals(network.Tolower())){                              var icon = child.HasValue("CSSClass") ? String.Format("<i class=\"{0}\"></i>",child.CSSClass) : String.Format("<img src=\"/imagegen.ashx?altimage=/images/assets/clear.gif&image={0}\" alt=\"{1}\"/>",child.Icon,child.name);                              return new HTMLString(String.Format("<a target=\"_blank\" rel=\"no-follow\" href=\"{0}\" Title=\"{3} on {1}\">{2}</a>",url,child.name,icon,name) );                          }                          socialNetworks.Add(child);                      }                  }                  return new HTMLString("");              }          }@{if (String.IsNullOrEmpty(Request["name"])){    return;}var profileID = Request["name"].Replace("-"," ").Replace("/","");var lawyersRepository = library.NodeByID(1316);var isIntranet = Homepage.name.IndexOf("intranet",StringComparison.OrdinalignoreCase) > -1;var nodes = isIntranet ? lawyersRepository.Children.Where("name.Tolower() = \"" + profileID.Tolower() + "\"") : lawyersRepository.Children.Where("!ProfileIsPrivate && name.Tolower() = \"" + profileID.Tolower() + "\"");if(!nodes.Any()){    return;}var node = nodes.First();if (node == null || node.NodeTypeAlias != "LawyerRepositoryItem"){    return;}if (node.ProfileIsPrivate && !isIntranet){    return;}PageData["PageTitle"] = Model.name + " - " + node.name;SetPageTitle(Model.name + " - " + node.name);var hasContactInfo = (!String.IsNullOrEmpty(node.TelephoneNumber) || !String.IsNullOrEmpty(node.EmailAddress) || !String.IsNullOrEmpty(node.OfficeLocation));<div >    <div >        <div >            <h1>@node.name</h1>            <h3>@node.JobTitle</h3>            @HTML.Raw(node.Biography.ToString())        </div>        <div >            <div >                @{                    if (!node.HasValue("ProfilePictureSquare")){                        <img src="/imagegen.ashx?altimage=/images/assets/clear.gif&image=@library.MediaByID(node.ProfilePicture).umbracofile" alt="@node.name" />                    }                    else{                        <img src="/imagegen.ashx?altimage=/images/assets/clear.gif&image=@library.MediaByID(node.ProfilePictureSquare).umbracofile" alt="@node.name" />                    }                }            </div>            <div >                <!--Tesimonial-->                @RenderPage("~/macroScripts/Widgets/Widget_RandomTestimonial.csHTML",@node.ID.ToString())            </div>        </div>        @if (hasContactInfo)        {            <div >                <div >                    <h4>@Dictionary.Contactinformationheading</h4>                    <dl >                        @{            if (node.HasValue("TelephoneNumber"))            {                                <dd><strong>@Dictionary.Label_Telephoneshort:</strong>  @node.TelephoneNumber</dd>            }            if (node.HasValue("EmailAddress"))            {                                <dd><strong>@Dictionary.Label_EmailShort:</strong> <a href="mailto:@node.EmailAddress?subject=@Dictionary.DefaultEmailSubjectline">@node.EmailAddress</a></dd>            }            if (node.HasValue("OfficeLocation"))            {                var officeNode = library.NodeByID(node.OfficeLocation);                                <dd><strong>@Dictionary.Label_Office:</strong> <a href="@officeNode.NiceUrl" title="@officeNode.name">@officeNode.name</a></dd>            }                        }                    </dl>                </div>                <div >                    <h4>                        <a href="/vcard.ashx?contact=@node.ID" title="@Dictionary.DownloadVCard"><i ></i> <span>@Dictionary.DownloadVCard</span></a></h4>                </div>            </div>        }        @{            var hasSocialMediaUrls = node.HasValue("FacebookUrl") || node.HasValue("TwitterUrl") || node.HasValue("linkedInUrl") || node.HasValue("YouTubeUrl") || node.HasValue("BlogUrl");            if (hasSocialMediaUrls)            {                <div >                    <ul >                        <li><strong>@Dictionary.Connect</strong></li>                        @if (node.HasValue("FacebookUrl"))                        {                            <li>@GetSocialMedialink("facebook",node.FacebookUrl,node.name)</li>                        }                        @if (node.HasValue("TwitterUrl"))                        {                            <li>@GetSocialMedialink("twitter",node.TwitterUrl,node.name)</li>                        }                        @if (node.HasValue("linkedInUrl"))                        {                            <li>@GetSocialMedialink("linkedin",node.linkedInUrl,node.name)</li>                        }                        @if (node.HasValue("YouTubeUrl"))                        {                            <li>@GetSocialMedialink("youtube",node.YouTubeUrl,node.name)</li>                        }                        @if (node.HasValue("BlogUrl"))                        {                            <li>@GetSocialMedialink("blogger",node.BlogUrl,node.name)</li>                        }                    </ul>                </div>            }        }    </div>    <div >        <a href="@Dictionary.submitTestimoniallink@Dictionary.submitTestimoniallinkParameters.Replace("{name}",node.name)">@Dictionary.submitTestimonialText</a>    </div></div>        }

我试过从备份文件加载但问题仍然存在.

解决方法 您需要找出出现此错误的原因.

如果您在宏中运行并且处于WebForms模式,则可以在URL处添加?umbDeBUGShowTrace = true(或?umbDeBUG = true). (首先检查web.config中的umbracoDeBUGMode appsetting是否为true).

如果这不起作用,请检查App_Data / Logs /文件夹中是否有任何日志文件.你应该在那里看到完整的错误.如果您有旧版本,请检查umbracolog数据库表.

总结

以上是内存溢出为你收集整理的宏 – 加载MacroEngine脚本出错(文件:LawyerProfileView.cshtml)全部内容,希望文章能够帮你解决宏 – 加载MacroEngine脚本时出错(文件:LawyerProfileView.cshtml)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1074389.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存