Error executing template "Designs/LM2016/_parsed/MainSubpageNav.parsed.cshtml"
System.ArgumentException: Object type cannot be converted to target type.
   at RazorEngine.Compilation.CrossAppDomainCleanUp.CleanupHelper.Init(AppDomain domain, IPrinter printer)
   at RazorEngine.Compilation.CrossAppDomainCleanUp.InitHelper.CreateHelper()
   at RazorEngine.Compilation.ExecutionContextLessThread.CallHelperSafeHelper`2.AsAction()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at RazorEngine.Compilation.ExecutionContextLessThread.DefaultCallFunc[O](Func`1 f)
   at RazorEngine.Compilation.CrossAppDomainCleanUp..ctor(AppDomain toWatch, IPrinter printer)
   at RazorEngine.Compilation.CrossAppDomainCleanUp.CreateInitial()
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at RazorEngine.Compilation.CrossAppDomainCleanUp.RegisterCleanup(String item, Boolean throwOnDefault)
   at RazorEngine.Templating.InvalidatingCachingProvider.CacheTemplate(ICompiledTemplate template, ITemplateKey templateKey)
   at RazorEngine.Templating.RazorEngineService.CompileAndCacheInternal(ITemplateKey key, Type modelType)
   at RazorEngine.Templating.RazorEngineService.GetCompiledTemplate(ITemplateKey key, Type modelType, Boolean compileOnCacheMiss)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 2 @using System; 3 4 <!DOCTYPE html> 5 <html lang='@GetString("LongLang")'> 6 <head> 7 <meta charset="utf-8"> 8 <title>@GetValue("Title")</title> 9 @GetValue("MetaTags") 10 @GetValue("CopyRightNotice") 11 12 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 13 @using System; 14 @using Dynamicweb.Frontend; 15 16 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 17 18 <meta name="author" content=""> 19 @foreach (var language in GetLoop("Languages").Where(l => (l.GetString("Culture") != "ru-RU" && !string.IsNullOrEmpty(l.GetString("PageID"))@*&& !l.GetBoolean("PageIsHidden")*@))) { 20 string lang = language.GetString("Culture").Substring(3) == "US" ? language.GetString("Culture") : language.GetString("Culture").Substring(0, 2); 21 string link = "https://" + language.GetString("PrimaryDomain") + SearchEngineFriendlyURLs.GetFriendlyUrl(language.GetInteger("PageID")); 22 <link rel="alternate" hreflang='@lang' href='@link'> 23 } 24 25 @RenderSnippet("StyleSheet") 26 27 @{ 28 string favicon = Convert.ToString(Pageview.Area.Item["Favicon"]); 29 string faviconUrl = GetString("Template:DesignBaseUrl") + "assets/images/" + favicon; 30 string customCSS = Convert.ToString(Pageview.Area.Item["Custom_CSS_Url"]); 31 string customCssUrl = "assets/stylesheets" + customCSS; 32 if (!string.IsNullOrEmpty(customCSS)) { 33 <link href="@customCssUrl" rel="stylesheet" media="screen"> 34 } 35 if (!string.IsNullOrEmpty(favicon)) { 36 <link rel="icon" type="image/png" href="@faviconUrl"> 37 } 38 } 39 40 @RenderSnippet("JavaScriptHead") 41 42 <link href="/Files/Templates/Designs/LM2016/assets/stylesheets/screen.css" rel="stylesheet" media="screen"> 43 <link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800|Open+Sans+Condensed:300,300italic,700' rel='stylesheet' type='text/css'> 44 45 <script type="text/javascript" src="https://secure.leadforensics.com/js/59050.js"></script> 46 <noscript><img alt="" src="https://secure.leadforensics.com/59050.png" style="display:none;"></noscript> 47 48 @if (!string.IsNullOrEmpty(Convert.ToString(Pageview.Area.Item["Google_Analytics_ID"])) ) { 49 <script> 50 var setCookie = ("@Dynamicweb.Environment.CookieManager.GetCookieOptInLevel().ToString()" != "All") ? true : false; 51 window['ga-disable-@Pageview.Area.Item["Google_Analytics_ID"]'] = setCookie; 52 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 53 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 54 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 55 })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); 56 57 ga('create', '@Pageview.Area.Item["Google_Analytics_ID"]', '@GetGlobalValue("Global:Area.Primarydomain")'); 58 ga('require', 'displayfeatures'); 59 ga('send', 'pageview'); 60 </script> 61 } 62 63 @GetValue("Stylesheets") 64 @GetValue("Javascripts") 65 </head> 66 @{ 67 string firstActive = GetString("DwAreaFirstActivePageID"); 68 bool isMobile = Pageview.Device.ToString() == "Mobile"; 69 } 70 <body data-pageid='@Pageview.Page.ID' class='@GetGlobalValue("Global:Area.Name")'> 71 @if (isMobile) { 72 <text> 73 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 74 @using Dynamicweb.Rendering; 75 76 <div id="pushobj"> 77 <a type="button" class="btn btn-default" id="toggle" href="#phoneMenu"> 78 Menu 79 <i class="fa fa-reorder"></i> 80 </a> 81 </div> 82 <nav id="phoneMenu"> 83 <ul> 84 <li> 85 @GetValue("DwNavigation(navPhoneMain)") 86 </li> 87 <li> 88 <h6>@Translate("contactDownload", "Contact & Download")</h6> 89 @GetValue("DwNavigation(navPhoneTop)") 90 </li> 91 <li> 92 <h6>@Translate("languages", "Languages")</h6> 93 </li> 94 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 95 96 @foreach (var language in GetLoop("Languages").Where(l => l.GetString("Culture")!="ru-RU")) { 97 string culture = language.GetString("Culture"); 98 if (!language.GetBoolean("IsCurrent")) { 99 string languagePage = (!string.IsNullOrEmpty(language.GetString("PageID")) && !language.GetBoolean("PageIsHidden")) ? language.GetString("PageID") : language.GetString("FirstPageID"); 100 <li class="flags @culture.Substring(3).ToLower()"><a href="/Default.aspx?ID=@languagePage" hreflang="@culture.Substring(0, 2)">@language.GetString("Name")</a></li> 101 } else { 102 <li class="flags @culture.Substring(3).ToLower() active">@language.GetString("Name")</li> 103 } 104 } 105 106 </ul> 107 </nav> 108 109 </text> 110 } else { 111 <section class="topmenu-wrapper"> 112 <div class="container"> 113 <div class="topmenu"> 114 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 115 @using Dynamicweb.Rendering; 116 117 <nav class="navbar hidden-print" data-equable="true" role="navigation"> 118 <button type="button" class="btn btn-default navbar-toggle" data-toggle="collapse" data-target="#topnav"> 119 <span class="icon-bar"></span> 120 <span class="icon-bar"></span> 121 <span class="icon-bar"></span> 122 </button> 123 <div class="collapse navbar-collapse" id="topnav"> 124 <ul class="nav lang-selector"> 125 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 126 127 @foreach (var language in GetLoop("Languages").Where(l => l.GetString("Culture")!="ru-RU")) { 128 string culture = language.GetString("Culture"); 129 if (!language.GetBoolean("IsCurrent")) { 130 string languagePage = (!string.IsNullOrEmpty(language.GetString("PageID")) && !language.GetBoolean("PageIsHidden")) ? language.GetString("PageID") : language.GetString("FirstPageID"); 131 <li class="flags @culture.Substring(3).ToLower()"><a href="/Default.aspx?ID=@languagePage" hreflang="@culture.Substring(0, 2)">@language.GetString("Name")</a></li> 132 } else { 133 <li class="flags @culture.Substring(3).ToLower() active">@language.GetString("Name")</li> 134 } 135 } 136 137 </ul> 138 <ul class="nav"> 139 @if (!string.IsNullOrEmpty(GetString("DW_extranet_AccessUserID"))) { 140 <li> 141 <a href='Default.aspx?ID=@GetString("DwPageID")'> 142 Logged in as 143 '@GetString("DW_extranet_AccessUserName")' 144 </a> 145 </li> 146 <li> 147 <a href='/Admin/Public/extranetlogoff.aspx?ID=@GetString("DwPageID")'>Log out</a> 148 </li> 149 } else { 150 <li><a href="javascript:void(0);" data-toggle="modal" data-target="#login">Log in</a></li> 151 } 152 </ul> 153 @GetValue("DwNavigation(navTop)") 154 </div> 155 156 </nav> 157 158 </div> 159 </div> 160 </section> 161 } 162 <header class="header-wrapper" data-spy="affix" data-offset-top="65"> 163 <div class="container"> 164 <div class="logo-wrapper"> 165 <div class="logo"> 166 <a href='/Default.aspx?ID=@firstActive' class="logo-image"></a> 167 </div> 168 <div class="search-box"> 169 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 170 <form method="get" action="/Default.aspx" class="form-search"> 171 <input type="hidden" name="ID" value='@GetString("DwAreaSearchPageID")'> 172 <div class="input-group"> 173 <input class="form-control" type="search" name="q"> 174 <span class="input-group-btn"> 175 <button type="submit" value="Search" class="btn"><span class="fa fa-search icon-wht"></span></button> 176 </span> 177 </div> 178 </form> 179 180 </div> 181 @if (!isMobile) { 182 <div class="mainmenu"> 183 <nav class="navbar wrappable" data-equable="true" role="navigation"> 184 <button type="button" class="btn btn-default navbar-toggle" data-toggle="collapse" data-target="#mainnav"> 185 <span class="icon-bar"></span> 186 <span class="icon-bar"></span> 187 <span class="icon-bar"></span> 188 </button> 189 <div class="collapse navbar-collapse" id="mainnav"> 190 @GetValue("DwNavigation(NavMain)") 191 </div> 192 </nav> 193 </div> 194 } 195 </div> 196 </div> 197 </header> 198 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 199 @using System; 200 201 202 203 204 205 @{ 206 int contentCol = 12; 207 bool menu = (Pageview.Page.PropertyItem != null) ? Convert.ToBoolean(Pageview.Page.PropertyItem["ShowMenu"]) : true; 208 } 209 210 <section class="page-wrapper"> 211 <section class="container content-wrapper"> 212 <div class="row"> 213 @if (!isMobile && menu) { 214 contentCol = 9; 215 <nav class="navbar subpage-nav-wrapper subnav" role="navigation"> 216 <div class="navbar-header"> 217 <h5>@GetGlobalValue("Global:Page.Name")</h5> 218 <div class="search-box"> 219 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>> 220 <form method="get" action="/Default.aspx" class="form-search"> 221 <input type="hidden" name="ID" value='@GetString("DwAreaSearchPageID")'> 222 <div class="input-group"> 223 <input class="form-control" type="search" name="q"> 224 <span class="input-group-btn"> 225 <button type="submit" value="Search" class="btn"><span class="fa fa-search icon-wht"></span></button> 226 </span> 227 </div> 228 </form> 229 230 </div> 231 <button type="button" class="btn btn-default navbar-toggle" data-toggle="collapse" data-target="#subpage-nav"> 232 <span class="sr-only">Toggle navigation</span> 233 <span class="icon-bar"></span> 234 <span class="icon-bar"></span> 235 <span class="icon-bar"></span> 236 </button> 237 </div> 238 <div class="collapse navbar-collapse" id="subpage-nav"> 239 @GetValue("DwNavigation(subpageNav)") 240 </div> 241 </nav> 242 } 243 244 <div class="col-md-@contentCol col-sm-@contentCol"> 245 <div class="content-main" id="content-main">@GetValue("DwContent(contentmain)")</div> 246 @if (!string.IsNullOrEmpty(GetString("DwContent(sectionmain)"))){ 247 <div class="section-main content-main" id="section-main">@GetValue("DwContent(sectionmain)")</div> 248 } 249 @if (!string.IsNullOrEmpty(GetString("DwContent(gallerymain)"))){ 250 <div class="gallery-main content-main" id="gallery-main">@GetValue("DwContent(gallerymain)")</div> 251 } 252 </div> 253 254 </div> 255 256 <div class="modal fade" id="Modal" tabindex="-1" role="dialog" aria-labelledby="Modal" aria-hidden="true"> 257 <div class="modal-dialog"> 258 <div class="modal-content"> 259 <div class="modal-header"> 260 <button type="button" class="close icon-remove" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> 261 <h4 class="modal-title" id="ModalLabel"></h4> 262 </div> 263 <div class="modal-body"> 264 </div> 265 <div class="modal-footer"> 266 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 267 </div> 268 </div> 269 </div> 270 </div> 271 272 </section> 273 274 </section> 275 <footer class="footer-wrapper"> 276 <section class="container"> 277 <div id="footerSections" title="Footer sections"> 278 @RenderPageContent(Convert.ToInt32(Pageview.Area.Item["Footer_Content_Page_ID"])) 279 </div> 280 </section> 281 </footer> 282 283 @*@RenderPageContent(Convert.ToInt32(Pageview.Area.Item["EmailSignupPageId"]))*@ 284 285 <script src="/Files/Templates/Designs/LM2016/assets/vendor/require.min.js"></script> 286 <script src="/Files/Templates/Designs/LM2016/assets/vendor/dynamicweb.start.min.js"></script> 287 @RenderSnippet("JavaScriptBottom") 288 <div class="modal fade" id="login" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 289 <div class="modal-dialog modal-sm"> 290 <div class="modal-content"> 291 <div class="modal-header"> 292 <h4 class="modal-title" id="myModalLabel">@Translate("Login", "Login")</h4> 293 </div> 294 <form role="form" id="loginform" method="post"> 295 <div class="modal-body"> 296 @if (!string.IsNullOrWhiteSpace(GetString("DW_extranet_error_uk"))) { 297 <script>alert("@GetValue("DW_extranet_error_uk")");</script> 298 } 299 <input type="hidden" name="ID" value="@Pageview.Page.ID"> 300 <input type="hidden" name="DWExtranetUsernameRemember" value="True"> 301 <input type="hidden" name="DWExtranetPasswordRemember" value="True"> 302 <div class="form-group"> 303 <label for="username">@Translate("Email address", "Email address")</label> 304 <input type="text" class="form-control" name="username" id="username" placeholder='@Translate("Enter username", "Enter username")' value='@GetValue("DWExtranetUsername")' style="width: 100% !important;"> 305 </div> 306 <div class="form-group" style="padding-top: 10px"> 307 <label for="password">@Translate("Password", "Password")</label> 308 <input type="password" class="form-control" name="password" id="password" placeholder='@Translate("Enter password", "Enter password")' style="width: 100% !important;"> 309 <p>&nbsp;</p> 310 <a class="pull-left" href='/Default.aspx?ID=@GetString("DwAreaFirstActivePageID")&LoginAction=Recovery'>@Translate("Forgot your password?", "Forgot your password?")</a> 311 <text>&nbsp;</text> 312 </div> 313 </div> 314 <div class="modal-footer"> 315 <div class="checkbox pull-left" style="margin-top: 0 !important"> 316 <label> 317 <input type="checkbox" name="Autologin" checked="checked" value="True"> @Translate("Remember me", "Remember me") 318 </label> 319 </div> 320 <button type="submit" class="btn btn-xs pull-right">@Translate("Sign in", "Sign in")</button> 321 </div> 322 </form> 323 </div> 324 </div> 325 </div> 326 </body> 327 </html> 328