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