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