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