Error executing template "Designs/identity_v2/_parsed/espresso.parsed.cshtml"
System.NullReferenceException: Object reference not set to an instance of an object.
   at CompiledRazorTemplates.Dynamic.RazorEngine_9eebb4680d554fdca093d2420d9d49d7.Execute() in D:\dynamicweb.net\Solutions\id.espresso4.dk-e5\Application\Files\Templates\Designs\identity_v2\_parsed\espresso.parsed.cshtml:line 40
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
   at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
   at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.<RunCompile>b__0(TextWriter writer)
   at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
   at Dynamicweb.Rendering.RazorTemplateRenderingProvider.Render(Template template)
   at Dynamicweb.Rendering.TemplateRenderingService.Render(Template template)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()

1 @inherits Co3.Espresso.Website.TemplateBases.Pages.PageBase 2 @using System.Data 3 @using System.IO 4 @using System.Web 5 @using System.Globalization 6 @using System.Web.Script.Serialization 7 @using Co3.Espresso.Website.Models.FrontEnd 8 @using Co3.Espresso.Website.Services 9 @using Co3.ID.Dw.Helpers 10 @using Co3.ID.Dw.Models.Frontend.Ecommerce 11 @using Dynamicweb.Frontend 12 @using Dynamicweb.Ecommerce.Common 13 @using Dynamicweb.Environment 14 @using Dynamicweb.Security.UserManagement 15 @using Newtonsoft.Json 16 17 @{ 18 ShopType shopContext = SiteContext.CurrentSiteContext(); 19 20 bool isUserAuthenticated = shopContext == ShopType.B2B; 21 string globalAreaLang = PageView.Current().Area.CultureInfo.TwoLetterISOLanguageName; 22 string globalAreaName = PageView.Current().Area.UrlName; 23 int areaId = PageView.Current().Area.ID; 24 25 bool isStagingUrl = HttpContext.Current.Request.Url.Host.ToLowerInvariant().Contains("staging"); 26 bool isProductPage = HttpContext.Current.Request["productid"] != null; 27 28 bool globalPrefix = PageView.Current().Area.UrlIgnoreForChildren; 29 if (globalPrefix == true) 30 { 31 globalAreaName = string.Empty; 32 } 33 CultureInfo currencyCulture = new CultureInfo(Context.Currency.CultureInfo); 34 35 string currencySeparatorDecimal = PageView.Current().User != null ? ExecutingContext.GetCulture().NumberFormat.NumberDecimalSeparator : currencyCulture.NumberFormat.NumberDecimalSeparator; 36 string currencySeparatorInteger = PageView.Current().User != null ? ExecutingContext.GetCulture().NumberFormat.NumberGroupSeparator : currencyCulture.NumberFormat.NumberGroupSeparator; 37 38 string openGraphUrl = PageView.Current().SearchFriendlyUrl; 39 string openGraphImage = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host + Espresso.OpenGraphImage; 40 bool loadGoogleTagManager = !string.IsNullOrEmpty(Espresso.Area.GoogleTagManagerID) && 41 !(Espresso.Area.Item.GoogleTagManagerDisableIfPerformanceTestIsDetected == "True" && HttpContext.Current.Request.UserAgent.ToLower().Contains("lighthouse")); 42 43 string espressoCriticalJsFile = HttpContext.Current.Server.MapPath("/Files/Templates/Designs/identity_v2/_assets/_dist/js/critical.js"); 44 string espressoCriticalJs = File.ReadAllText(espressoCriticalJsFile); 45 46 string espressoCriticalCssFile = HttpContext.Current.Server.MapPath("/Files/Templates/Designs/identity_v2/_assets/_dist/css/critical.css"); 47 string espressoCriticalCss = File.ReadAllText(espressoCriticalCssFile); 48 49 object campaignColors = Co3.ID.Dw.Services.AreaService.Instance.GetAreaCampaignSwatches(PageView.Current().AreaID); 50 51 bool shouldTrackRelewise = shopContext != ShopType.CustomerShop; 52 53 } 54 <!DOCTYPE html> 55 <html lang="@globalAreaLang" data-separator-integer="@currencySeparatorInteger" data-separator-decimal="@currencySeparatorDecimal" data-area="@globalAreaName" data-area-id="@areaId" data-state="@shopContext.ToString()" data-context="id" data-is-b2b="@(shopContext == ShopType.B2B)"> 56 <head> 57 <!-- The initial config of Consent Mode --> 58 59 <script> 60 window.dataLayer = window.dataLayer || []; 61 62 function gtag(){ dataLayer.push(arguments); } 63 64 gtag('consent', 'default', { 65 'ad_storage': 'denied', 66 'ad_user_data': 'denied', 67 'ad_personalization': 'denied', 68 'analytics_storage': 'denied', 69 'wait_for_update': 500 70 }); 71 gtag('set', 'ads_data_redaction', true); 72 </script> 73 74 <!-- Cookie Information Pop-up Script is required for the SDK --> 75 <script id="CookieConsent" src="https://policy.app.cookieinformation.com/uc.js" data-culture="@globalAreaLang.ToUpperInvariant()" data-gcm-version="2.0" type="text/javascript"></script> 76 77 78 @if (loadGoogleTagManager) 79 { 80 <!-- Google Tag Manager --> 81 <script> 82 (function(w, d, s, l, i) { 83 w[l] = w[l] || []; 84 w[l].push({ 85 'gtm.start': 86 new Date().getTime(), 87 event: 'gtm.js' 88 }); 89 90 var f = d.getElementsByTagName(s)[0], 91 j = d.createElement(s), 92 dl = l != 'dataLayer' ? '&l=' + l : ''; 93 j.async = true; 94 j.src = 95 'https://www.googletagmanager.com/gtm.js?id=' + i + dl; 96 f.parentNode.insertBefore(j, f); 97 })(window, document, 'script', 'dataLayer', '@Espresso.Area.GoogleTagManagerID'); 98 </script> 99 <!-- End Google Tag Manager --> 100 } 101 @GetValue("CopyRightNotice") 102 <meta charset="utf-8"> 103 <meta content="width=device-width, initial-scale=1, shrink-to-fit=no, minimal-ui" name="viewport"> 104 <meta content="ie=edge" http-equiv="x-ua-compatible"> 105 <link href="https://cdnjs.cloudflare.com" rel="preconnect"> 106 <link href="https://www.googletagmanager.com" rel="preconnect"> 107 <link href="https://www.google-analytics.com" rel="preconnect"> 108 <link href="https://connect.facebook.net" rel="preconnect"> 109 <title>@GetValue("Title")</title> 110 <style> 111 @espressoCriticalCss 112 </style> 113 @RenderSnippet("webfonts") 114 <link href="/Files/Templates/Designs/identity_v2/_assets/_dist/css/default.css?v=2.26" media="@Espresso.StylesheetAttributeMedia" rel="@Espresso.StylesheetAttributeRel" as="style"> 115 <script> 116 @espressoCriticalJs 117 </script> 118 <script> 119 var campaignColors = @campaignColors; 120 var root = document.querySelector(':root'); 121 Object.keys(campaignColors).forEach(function (swatchKey){ 122 if(swatchKey.indexOf('BrandColor') > -1){ 123 root.style.setProperty(`--campaign-bg-${swatchKey.replace('BrandColor', '')}`, campaignColors[swatchKey]); 124 } else{ 125 root.style.setProperty(`--campaign-text-${swatchKey.replace('NeutralColor', '')}`, campaignColors[swatchKey]); 126 } 127 }); 128 </script> 129 <link rel="shortcut icon" href="@Espresso.Area.Item.Favicon"> 130 <meta name="description" content="@Espresso.DynamicwebPage.Description"> 131 @GetValue("MetaTags") 132 @if (Espresso.IsStagingUrl) 133 { 134 <meta content="noindex,nofollow" name="robots"> 135 } 136 <meta property="og:url" content="@openGraphUrl"> 137 <meta property="og:title" content="@Espresso.OpenGraphTitle"> 138 <meta property="og:description" content="@Espresso.OpenGraphDescription"> 139 <meta property="og:image" content="@openGraphImage"> 140 <meta property="og:type" content="website"> 141 @if (string.IsNullOrEmpty(Espresso.Area.Item.GoogleSiteVerification) == false) 142 { 143 <meta name="google-site-verification" content="@Espresso.Area.Item.GoogleSiteVerification"> 144 } 145 146 @if (isStagingUrl == false) 147 { 148 <script> 149 window.sleeknoteSiteData || (window.sleeknoteSiteData = []); 150 </script> 151 } 152 153 154 155 @if (isStagingUrl == false) 156 { 157 <!-- Start of Sleeknote signup and lead generation tool - www.sleeknote.com --> 158 <script id='sleeknoteScript' type='text/javascript'> 159 (function () { var sleeknoteScriptTag = document.createElement('script'); 160 sleeknoteScriptTag.type = 'text/javascript'; 161 sleeknoteScriptTag.charset = 'utf-8'; 162 sleeknoteScriptTag.src = ('//sleeknotecustomerscripts.sleeknote.com/25665.js'); 163 var s = document.getElementById('sleeknoteScript'); 164 s.parentNode.insertBefore(sleeknoteScriptTag, s); 165 })(); 166 </script> 167 <!-- End of Sleeknote signup and lead generation tool - www.sleeknote.com --> 168 } 169 170 171 <script class="usercontext-gtm"> 172 dataLayer.push({ 173 'UserContext': '@shopContext.ToString()', 174 'event': 'UserContext' 175 }); 176 </script> 177 178 179 </head> 180 181 @{ 182 ClassList bodyClasses = new ClassList(); 183 bodyClasses.AddClasses( Espresso.Item.CustomClasses ); 184 185 bodyClasses.AddClasses($"shoptype-{shopContext.ToString()}"); 186 187 } 188 189 <body class="@bodyClasses" data-is-user-authenticated="@isUserAuthenticated.ToString().ToLower()" data-design="@Espresso.Area.DesignsFolderName"> 190 191 @if (loadGoogleTagManager) 192 { 193 <!-- Google Tag Manager (noscript) --> 194 <noscript> 195 <iframe src="https://www.googletagmanager.com/ns.html?id=@Espresso.Area.GoogleTagManagerID" height="0" width="0" style="display: none; visibility: hidden"></iframe> 196 </noscript> 197 <!-- End Google Tag Manager (noscript) --> 198 } 199 200 @using Co3.Espresso.Website.Models.FrontEnd 201 @using Co3.Espresso.Website.Models.FrontEnd.Settings 202 @using Co3.Espresso.Website.Services 203 @using Dynamicweb.Frontend 204 @inherits Co3.Espresso.Website.TemplateBases.Pages.PageBase 205 @{ 206 Espresso.Canvas.Classes.AddClasses( "js-e-canvas is-loading" ); 207 if ( Espresso.Item.CanvasFullscreen == "True" ) 208 { 209 Espresso.Canvas.Classes.AddClasses( "is-fullscreen" ); 210 } 211 string campaignSplash = Espresso.Area.Item.CampaignSplash; 212 213 string redirect = GetGlobalValue("Global:Pageview.Url.Raw"); 214 HttpCookie userSavedAreaLanguage = HttpContext.Current.Request.Cookies[ "e4.redirect.language" ]; 215 HttpCookie userDisableRedirect = HttpContext.Current.Request.Cookies[ "e4.redirect.disabled" ]; 216 } 217 218 219 220 <div class="e-loading-overlay e-page-loading-overlay is-loading js-e-page-loading-overlay"> 221 @RenderingService.Instance.PartialView( "_partials/loading-spinner.cshtml" ) 222 </div> 223 224 @RenderingService.Instance.PartialView( "_partials/webfonts.cshtml", Espresso ) 225 <div class="@Espresso.Canvas.Classes"> 226 @RenderingService.Instance.PartialView( "_partials/header.cshtml", Espresso ) 227 @RenderingService.Instance.PartialView( "usermanagement/viewprofile/espresso-impersonate-user-msg.cshtml", Espresso ) 228 229 <main id="dwcontentmain" class="e-content js-e-content @Espresso.ContentArea.Classes"> 230 @RenderingService.Instance.PartialView( "_partials/breadcrumb.cshtml", Espresso ) 231 <article class="e-content-article"> 232 @RenderingService.Instance.PartialView( "_partials/nav-local-horizontal.cshtml", Espresso ) 233 @RenderingService.Instance.PartialView( "_partials/nav-local-vertical.cshtml", Espresso ) 234 @RenderingService.Instance.SectionStart( new SectionSettings() ) 235 @GetValue("DwContent(dwcontentmain)") 236 @RenderingService.Instance.SectionEnd() 237 </article> 238 </main> 239 240 @RenderingService.Instance.PartialView( "_partials/footer.cshtml", Espresso ) 241 242 @if ( !string.IsNullOrEmpty( GetString( "DwContent(dwcontentcta)" ) ) ) 243 { 244 <aside class="e-cta fixed-top is-hidden js-e-cta" id="dwcontentcta"> 245 @RenderingService.Instance.SectionStart( new SectionSettings 246 { 247 ContentClasses = new ClassList( "col-12" ), 248 OuterRowClasses = new ClassList("row no-gutters"), 249 InnerRowClasses = new ClassList("row no-gutters justify-content-center align-items-center") 250 } ) 251 @GetValue("DwContent(dwcontentcta)") 252 @RenderingService.Instance.SectionEnd() 253 254 </aside> 255 } 256 257 @RenderingService.Instance.PartialView( "ecom7/cartv2/step/espresso-cart-msg.cshtml" ) 258 </div> 259 260 @RenderingService.Instance.PartialView( "_partials/search.cshtml", Espresso ) 261 262 @RenderingService.Instance.PartialView( "_partials/back-to-top.cshtml", Espresso ) 263 @RenderingService.Instance.PartialView("/Extranet/partials/identity-login.cshtml", Espresso) 264 265 @if (string.IsNullOrEmpty(campaignSplash) == false) 266 { 267 int campaignSplashParagraphId; 268 int.TryParse(campaignSplash, out campaignSplashParagraphId); 269 if (campaignSplashParagraphId > 0) 270 { 271 @RenderParagraphContent(campaignSplashParagraphId); 272 } 273 274 } 275 276 @if ( 1 == 2 ) 277 { 278 @GetValue("DwCookieWarning") 279 } 280 281 @if ( userSavedAreaLanguage == null ) 282 { 283 //@RenderingService.Instance.PartialView( "_partials/redirect.cshtml" ) 284 } 285 else 286 { 287 string currentAreaLanguage = PageView.Current().Area.UrlName; 288 string savedAreaLanguage = userSavedAreaLanguage.Value; 289 bool disabledRedirectForSession = userDisableRedirect != null ? Boolean.Parse( HttpContext.Current.Request.Cookies[ "e4.redirect.disabled" ].Value ) : false; 290 291 if ( currentAreaLanguage != savedAreaLanguage && disabledRedirectForSession == false ) 292 { 293 string redirectUrl = string.Format( "{0}://{1}/{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, savedAreaLanguage); 294 HttpContext.Current.Response.Redirect(redirectUrl); 295 296 } 297 298 } 299 300 @if ( shouldTrackRelewise ) 301 { 302 303 IdentityProduct itemIdentityProduct = (IdentityProduct)HttpContext.Current.Items["IdentityProduct"]; 304 bool isRelewiseCategoryPage = PageView.Current().Page.Item["RelewiseCategory"] != null ? (bool)PageView.Current().Page.Item["RelewiseCategory"] : false; 305 306 if (isRelewiseCategoryPage) 307 { 308 string productCategory = (string)HttpContext.Current.Items["IdentityProductCategory"]; 309 if (!string.IsNullOrEmpty(productCategory)) 310 { 311 Co3.ID.Dw.Relewise.Services.TrackerService.Instance.TrackCategoryView(PageView.Current().Page.ID.ToString()); 312 } 313 } else if (!isProductPage && itemIdentityProduct == null) 314 { 315 Co3.ID.Dw.Relewise.Services.TrackerService.Instance.TrackContentView(PageView.Current().Page.ID.ToString()); 316 } else if (isProductPage && itemIdentityProduct != null) 317 { 318 Co3.ID.Dw.Relewise.Services.TrackerService.Instance.TrackProductView(itemIdentityProduct); 319 } 320 } 321 322 @Co3.ID.Dw.Services.ScriptService.Instance.RenderScripts() 323 @Co3.ID.Dw.Services.ScriptService.Instance.GetScript("default") 324 325 </body> 326 327 @GetValue("CopyRightNotice") 328 </html>