Error executing template "Designs/v2/_parsed/activity.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 <!DOCTYPE HTML> 2 <!-- 3 Based on Industrious by TEMPLATED 4 templated.co (at)templatedco 5 Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) 6 ** THE ORIGINAL WORK HAS BEEN MODIFIED ** 7 --> 8 9 @using System; 10 @using System.Text; 11 @using System.Data; 12 @using Dynamicweb.Data; 13 @using System.Web; 14 15 @functions{ 16 17 int MemberCount(string area) 18 { 19 int count = 0; 20 21 using(var connection = Database.CreateConnection()){ 22 23 using (var command = connection.CreateCommand()) 24 { 25 string sql = "SELECT count(*) as cnt FROM page WHERE pageitemtype = 'member' AND pageareaid = " + @area + " AND pageactive = 'true'"; 26 27 command.CommandText = sql; 28 29 using (var reader = command.ExecuteReader()) 30 { 31 while (reader.Read()) 32 { 33 34 count = int.Parse(reader[0].ToString()); 35 } 36 37 } 38 } 39 } 40 return count; 41 } 42 43 } 44 45 @{ 46 var lang = GetGlobalValue("Global:Area.LongLang"); 47 var area = GetGlobalValue("Global:Area.ID"); 48 var Areaname = GetGlobalValue("Global:Area.Name").Replace("ø", "oe").ToLower(); 49 50 var title = GetString("Title"); 51 var pageurl = GetGlobalValue("Global:Request.Scheme") + "://" + GetGlobalValue("Global:Request.Host") + GetGlobalValue("Global:Pageview.Url"); 52 var pagedescription = GetString("Meta.Description"); 53 var defaultshareimg = GetString("Item.Area.ShareImage"); 54 55 var navigationtag = GetGlobalValue("Global:Page.NavigationTag"); 56 var sitelogo = GetString("Item.Area.Logo"); 57 var sitelink = "/" + Areaname; 58 var sitename = GetString("Item.Area.Name"); 59 var payoff = GetString("Item.Area.Payoff"); 60 var link = GetString("Item.Area.PayoffLink"); 61 var linktxt = GetString("Item.Area.LinkText"); 62 var symbol_w = GetString("Item.Area.AltSymbol"); 63 var symbol = GetString("Item.Area.Symbol"); 64 var vat = GetString("Item.Area.VAT"); 65 var about = GetString("Item.Area.About"); 66 var address = GetString("Item.Area.Address"); 67 var address2 = GetString("Item.Area.Address2"); 68 var phone = GetString("Item.Area.Phone"); 69 var email = GetString("Item.Area.Email"); 70 var skype = GetString("Item.Area.Skype"); 71 var hours = GetString("Item.Area.Hours"); 72 73 bool newsletter = GetBoolean("Item.Area.Newsletter"); 74 75 var fblink = GetString("Item.Area.FbLink"); 76 var instalink = GetString("Item.Area.InstaLink"); 77 var inlink = GetString("Item.Area.InLink"); 78 var ytlink = GetString("Item.Area.YtLink"); 79 var twlink = GetString("Item.Area.TwLink"); 80 var fbpixel = GetString("Item.Area.FbPixel"); 81 } 82 83 <html lang='@lang'> 84 <head> 85 <!-- Global site tag (gtag.js) - Google Analytics --> 86 <script async="" src="https://www.googletagmanager.com/gtag/js?id=UA-156843986-1"></script> 87 <script> 88 window.dataLayer = window.dataLayer || []; 89 function gtag(){dataLayer.push(arguments);} 90 gtag('js', new Date()); 91 92 gtag('config', 'UA-156843986-1', { 'anonymize_ip': true }); 93 </script> 94 95 <title>@GetValue("Title")</title> 96 @GetValue("MetaTags") 97 @GetValue("CopyRightNotice") 98 99 <meta charset="utf-8"> 100 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> 101 <meta http-equiv="content-type" content="text/html; charset=utf-8"> 102 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 103 104 <meta property="og:url" content="@pageurl"> 105 <meta property="og:title" content="@title"> 106 <meta property="og:description" content="@pagedescription"> 107 <meta property="og:type" content='website'> 108 @RenderSnippet("FbMetaImg") 109 <meta property="og:image:width" content="1200px"> 110 <meta property="og:image:height" content="510px"> 111 112 <link rel="shortcut icon" href="/Files/Templates/Designs/v2/assets/gfx/favicon.ico" type="image/x-icon"> 113 <link rel="icon" href="/Files/Templates/Designs/v2/assets/gfx/favicon.ico" type="image/x-icon"> 114 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" type="text/css"> 115 <script src="https://kit.fontawesome.com/2b4a6fd4ef.js"></script> 116 117 <link rel="stylesheet" href="/Files/Templates/Designs/v2/assets/css/unslider.css"> 118 <link rel="stylesheet" href="/Files/Templates/Designs/v2/assets/css/main.css"> 119 120 @if(!String.IsNullOrEmpty(@fbpixel)) { 121 @fbpixel 122 } 123 124 @GetValue("Stylesheets") 125 @GetValue("Javascripts") 126 </head> 127 128 <body class="is-preload @navigationtag"> 129 130 <!-- Header --> 131 <div id="header"> 132 <div class="inner"> 133 <div> 134 <h1><a class="logo" href="@sitelink" style="background-image:url('@sitelogo')">@sitename</a></h1> 135 <div class="members @Areaname"><a href="@sitelink/medlemmer"><span id="membercount"><span id="membercount">@MemberCount(@area)</span></span> Medlemmer</a></div> 136 <div class="signup"><a class="button primary special" href="@sitelink/bli-medlem">Bli medlem</a></div> 137 </div> 138 </div> 139 <div class="menubar"> 140 <div class="inner"> 141 <h1><a class="symbol" href="@sitelink" style="background-image:url('@symbol_w')">@sitename</a></h1> 142 <div class="menu"> 143 @GetValue("DwNavigation(nav)") 144 <a href="#menu" id="navtoggle" title="Meny"><span>Meny</span></a> 145 <!--a href="/kontakt" id="contact" title="Kontakt oss">Kontakt</a--> 146 <div class="social"> 147 @if(!String.IsNullOrEmpty(@fblink)) { 148 <a href="@fblink" title="Facebook" target="_blank"><i class="fab fa-facebook-f"></i></a> 149 } 150 @if(!String.IsNullOrEmpty(@instalink)) { 151 <a href="@instalink" title="Instagram" target="_blank"><i class="fab fa-instagram"></i></a> 152 } 153 @if(!String.IsNullOrEmpty(@inlink)) { 154 <a href="@inlink" title="LinkedIn" target="_blank"><i class="fab fa-linkedin-in"></i></a> 155 } 156 @if(!String.IsNullOrEmpty(@ytlink)) { 157 <a href="@ytlink" title="Youtube" target="_blank"><i class="fab fa-youtube"></i></a> 158 } 159 @if(!String.IsNullOrEmpty(@twlink)) { 160 <a href="@twlink" title="Twitter" target="_blank"><i class="fab fa-twitter"></i></a> 161 } 162 </div> 163 </div> 164 </div> 165 </div> 166 </div> 167 168 <nav id="path"> 169 <div class="inner"> 170 @GetValue("DwNavigation(navpath)") 171 </div> 172 </nav> 173 174 <!-- Content --> 175 176 177 178 @{ 179 var image = GetString("Item.Image"); 180 } 181 182 @SnippetStart("FbMetaImg") 183 @if(!String.IsNullOrEmpty(@image)) { 184 <meta property="og:image" content='@GetGlobalValue("Global:Request.Scheme")://@GetGlobalValue("Global:Request.Host")@image'> 185 } else { 186 <meta property="og:image" content='@GetGlobalValue("Global:Request.Scheme")://@GetGlobalValue("Global:Request.Host")@defaultshareimg'> 187 } 188 @SnippetEnd("FbMetaImg") 189 190 @{ 191 192 int areaid = Dynamicweb.Frontend.PageView.Current().Area.ID; 193 string PageDisplayTitle = GetString("Item.Page.DisplayTitle"); 194 bool PageSubNav = GetBoolean("Item.Page.SubNav"); 195 int PageAlignment = GetInteger("Item.Page.Alignment"); 196 197 var PageId = GetGlobalValue("Global:Page.ID"); 198 var AltTitle = GetString("Item.AltTitle"); 199 var Title = GetString("Item.Title"); 200 string FocalPoint = GetString("Item.Image.FocalPointParameters"); 201 var signuplink = GetString("Item.SignupLink"); 202 203 var delay = ""; 204 var counter = 0; 205 206 string align = ""; 207 208 switch(PageAlignment) 209 { 210 case 1: 211 align = "left"; 212 break; 213 214 case 2: 215 align = "justify"; 216 break; 217 } 218 219 int formpage = 0; 220 221 switch(areaid) 222 { 223 case 1: // landing 224 break; 225 226 case 2: // trondheim 227 formpage = 63; 228 break; 229 230 case 3: // bergen 231 formpage = 303; 232 break; 233 234 case 5: // sør 235 formpage = 160; 236 break; 237 238 case 6: // molde 239 formpage = 208; 240 break; 241 242 case 7: // bodø 243 formpage = 240; 244 break; 245 case 8: // kristiansund 246 formpage = 2056; 247 break; 248 } 249 250 } 251 <section class="wrapper page activity"> 252 <div class="inner"> 253 254 @if(!String.IsNullOrEmpty(@image)){ 255 <figure class="image fit"> 256 <img src="/Admin/Public/GetImage.ashx?Image=@image&amp;Format=jpg&amp;Width=1600&amp;Height=680&amp;Crop=0&amp;@FocalPoint" alt="@Title"> 257 </figure> 258 } 259 260 <section class="wrapper mini"> 261 <div class="row gtr-200 gtr-uniform"> 262 <div class="col-8 col-12-medium"> 263 <header class="aligned @align special"> 264 <h2>@if(!String.IsNullOrEmpty(@AltTitle)){ 265 @AltTitle 266 } else { 267 @Title 268 } 269 </h2> 270 </header> 271 <div class="strong txt aligned @align special"> 272 @GetValue("Item.Teaser") 273 </div> 274 275 <div class="txt aligned @align special"> 276 @GetValue("Item.Text") 277 </div> 278 </div> 279 280 <div class="col-4 col-12-medium details info"> 281 <div class="innerwrapper"> 282 <div class="innercontent"> 283 <h3 class="upper">@GetString("Item.DetailsHeading")</h3> 284 <p><i class="fas fa-calendar fa-lg"></i> @GetDate("Item.Date").ToShortDateString()</p> 285 <p><i class="fas fa-clock fa-lg"></i> @GetString("Item.Duration")</p> 286 <p><i class="fas fa-map-marker-alt fa-lg"></i> @GetString("Item.Destination")</p> 287 <p><i class="fas fa-hourglass-end fa-lg"></i> @GetDate("Item.Deadline").ToShortDateString()</p> 288 289 @if(!String.IsNullOrEmpty(@signuplink)) { 290 <a class="button large readmore scrolly" href="@signuplink" target="_blank">Meld deg på</a> 291 } 292 </div> 293 </div> 294 </div> 295 296 297 <div class="wrapper"> 298 @if(Loops.Contains("Item.Team")) { 299 var count = GetLoop("Item.Team").Count; 300 301 if(count > 0) { 302 <div class="contact txt aligned @align special"> 303 @foreach(LoopItem contact in GetLoop("Item.Team")) 304 { 305 counter++; 306 delay = "0." + counter + "s"; 307 308 var contactemail = contact.GetString("Item.Team.Email"); 309 var contactphone = contact.GetString("Item.Team.Phone").Replace("+47","").Replace(" ",""); 310 string[] phonenum = { contactphone.Substring(0,3),contactphone.Substring(3,2),contactphone.Substring(5,3) }; 311 string formattedphonenum = String.Format("+47 {0} {1} {2}", phonenum); 312 var imgsrc = contact.GetString("Item.Team.Image"); 313 string focalpointparams = contact.GetString("Item.Team.Image.FocalPointParameters"); 314 315 <figure class="image fade-in" style="animation-delay: @delay;"> 316 <img src="/Admin/Public/GetImage.ashx?Image=@imgsrc&Format=jpg&Width=240&Height=300&Crop=0&@focalpointparams" alt='@contact.GetString("Item.Team.Name")'> 317 </figure> 318 <p> 319 Kontakt @contact.GetString("Item.Team.Name") ved spørsmål:<br> 320 telefon <a href="tel:0047 @contactphone">@formattedphonenum</a> eller e-post 321 <a href="mailto:@contactemail">@contactemail</a> 322 </p> 323 324 } 325 </div> 326 } 327 } 328 </div> 329 </div> 330 </section> 331 332 @* 333 <hr class="major"> 334 335 <section class="wrapper mini"> 336 <div id="enroll" class="anchor"></div> 337 338 @SnippetStart("details") 339 <p>@GetString("Item.Destination")<br>@GetDate("Item.Date").ToShortDateString(), @GetString("Item.Duration")</p> 340 @SnippetEnd("details") 341 342 @RenderPageContent(formpage) 343 344 </section> 345 *@ 346 </div> 347 </section> 348 349 @if(!String.IsNullOrEmpty(GetString("DwContent(content)"))) { 350 @SnippetStart("alignment") 351 @align 352 @SnippetEnd("alignment") 353 <section id="content" class="inner">@GetValue("DwContent(content)")</section> 354 } 355 356 357 <!-- Footer --> 358 <footer id="footer"> 359 <div class="inner"> 360 <div class="content"> 361 <section class="about"> 362 <h3 class="logo"> 363 <a href="@sitelink" style="background-image:url('@symbol')">@sitename</a> 364 </h3> 365 @if(!String.IsNullOrEmpty(@vat)) { 366 <p><small>Org.nr @vat</small></p> 367 } 368 <p>@payoff</p> 369 @about 370 @GetValue("DwNavigation(about)") 371 </section> 372 @if(newsletter) { 373 <section class="contact"> 374 <h4 class="upper">Nyhetsbrev</h4> 375 <div class="signup"> 376 <span>Ønsker du at vi holder deg oppdatert?</span> 377 <a href="@sitelink/om-oss/nyhetsbrev" class="button primary">Meld deg på vårt nyhetsbrev</a> 378 </div> 379 </section> 380 } 381 <section id="social"> 382 <div class="social"> 383 @if(!String.IsNullOrEmpty(@fblink)) { 384 <a href="@fblink" title="Facebook" target="_blank"><i class="fab fa-facebook-f"></i></a> 385 } 386 @if(!String.IsNullOrEmpty(@instalink)) { 387 <a href="@instalink" title="Instagram" target="_blank"><i class="fab fa-instagram"></i></a> 388 } 389 @if(!String.IsNullOrEmpty(@inlink)) { 390 <a href="@inlink" title="LinkedIn" target="_blank"><i class="fab fa-linkedin-in"></i></a> 391 } 392 @if(!String.IsNullOrEmpty(@ytlink)) { 393 <a href="@ytlink" title="Youtube" target="_blank"><i class="fab fa-youtube"></i></a> 394 } 395 @if(!String.IsNullOrEmpty(@twlink)) { 396 <a href="@twlink" title="Twitter" target="_blank"><i class="fab fa-twitter"></i></a> 397 } 398 </div> 399 </section> 400 </div> 401 <div class="copyright"> 402 &copy;@GetGlobalValue("Global:Server.Date.Year") <a href="@sitelink">@sitename</a> • Design og utvikling: <a class="devby" href="https://koment.no" target="_blank">KOMENT</a> 403 </div> 404 </div> 405 </footer> 406 407 <!-- Scripts --> 408 <script src="/Files/Templates/Designs/v2/assets/js/jquery.min.js"></script> 409 <script src="/Files/Templates/Designs/v2/assets/js/browser.min.js"></script> 410 <script src="/Files/Templates/Designs/v2/assets/js/breakpoints.min.js"></script> 411 <script src="/Files/Templates/Designs/v2/assets/js/jquery.scrolly.min.js"></script> 412 <script src="/Files/Templates/Designs/v2/assets/js/jquery.event.move.js"></script> 413 <script src="/Files/Templates/Designs/v2/assets/js/jquery.event.swipe.js"></script> 414 <script src="/Files/Templates/Designs/v2/assets/js/unslider-min.js"></script> 415 <script src="/Files/Templates/Designs/v2/assets/js/countUp.js" type="module"></script> 416 <script src="https://player.vimeo.com/api/player.js"></script> 417 <script src="/Files/Templates/Designs/v2/assets/js/util.js"></script> 418 <script src="/Files/Templates/Designs/v2/assets/js/main.js" type="module"></script> 419 420 </body> 421 </html>