Error executing template "Designs/Swift/_parsed/Swift_Page.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - An existing connection was forcibly closed by the remote host.) ---> System.ComponentModel.Win32Exception (0x80004005): An existing connection was forcibly closed by the remote host
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at Dynamicweb.Data.DatabaseConnectionProvider.CreateConnection(Boolean open)
at Dynamicweb.Data.Database.CreateConnection()
at Dynamicweb.Data.Database.CreateDataReader(CommandBuilder commandBuilder, IDbConnection connection, IDbTransaction transaction, Int32 commandTimeout)
at Dynamicweb.Ecommerce.Products.ProductRepository.GetProductById(String productId, String productVariantId, String productLanguageId)
at Dynamicweb.Ecommerce.Products.ProductService.FetchMissingProductsInternal(IProductRepository repo, IEnumerable`1 keys)
at Dynamicweb.Caching.ServiceCache`2.GetCache(IEnumerable`1 keys)
at Dynamicweb.Caching.ServiceCache`2.GetCache(TKey key)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, User user, Boolean showUntranslated)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId, Boolean useAssortments)
at Dynamicweb.Ecommerce.Products.ProductService.GetProductById(String productId, String productVariantId, String productLanguageId)
at CompiledRazorTemplates.Dynamic.RazorEngine_81430de46cf24a4ba7ebb926ad3f2a49.Execute() in D:\inetpub\wwwroot\www.cmi-nederland.nl\Application\Files\Templates\Designs\Swift\_parsed\Swift_Page.parsed.cshtml:line 355
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()
ClientConnectionId:a87747fa-f523-4676-b695-33ab9291a3c9
Error Number:10054,State:0,Class:20
1 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
2 @using System
3 @using Dynamicweb
4 @using Dynamicweb.Environment
5 @using Dynamicweb.Frontend
6
7 @{
8 string swiftVersion = ReadFile("/Files/Templates/Designs/Swift/swift_version.txt");
9 bool renderAsResponsive = Model.Area.Item.GetString("DeviceRendering", "responsive").Equals("responsive", StringComparison.OrdinalIgnoreCase);
10 bool renderMobile = Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Mobile || Pageview.Device == Dynamicweb.Frontend.Devices.DeviceType.Tablet;
11 string responsiveClassDesktop = string.Empty;
12 string responsiveClassMobile = string.Empty;
13 if (renderAsResponsive)
14 {
15 responsiveClassDesktop = " d-none d-xl-block";
16 responsiveClassMobile = " d-block d-xl-none";
17 }
18
19 var disableWideBreakpoints = Model.Area?.Item?.GetRawValueString("DisableWideBreakpoints", "default");
20
21 var brandingPageId = Model.Area.Item.GetLink("BrandingPage") != null ? Model.Area.Item.GetLink("BrandingPage").PageId : 0;
22 var themePageId = Model.Area.Item.GetLink("ThemesPage") != null ? Model.Area.Item.GetLink("ThemesPage").PageId : 0;
23 string customHeaderInclude = Model.Area.Item.GetFile("CustomHeaderInclude") != null ? Model.Area.Item.GetFile("CustomHeaderInclude").Name : string.Empty;
24
25 var brandingPage = Dynamicweb.Content.Services.Pages?.GetPage(brandingPageId) ?? null;
26 var themesParagraphLastChanged = Dynamicweb.Content.Services.Paragraphs.GetParagraphsByPageId(themePageId).OrderByDescending(p => p.Audit.LastModifiedAt).FirstOrDefault();
27
28 var cssLastModified = brandingPage.Audit.LastModifiedAt > themesParagraphLastChanged.Audit.LastModifiedAt ? brandingPage.Audit.LastModifiedAt : themesParagraphLastChanged.Audit.LastModifiedAt;
29 var cssThemeAndBrandingStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath($"/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css"));
30
31 // Schema.org details for PDP
32 string productId = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : "";
33 bool isProductDetailsPage = !string.IsNullOrEmpty(productId);
34 bool isArticlePage = Model.ItemType == "Swift_Article";
35 string schemaOrgType = string.Empty;
36
37 if (isProductDetailsPage)
38 {
39 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Product\"";
40 }
41
42 if (isArticlePage)
43 {
44 schemaOrgType = "itemscope=\"\" itemtype=\"https://schema.org/Article\"";
45 }
46
47 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < brandingPage.Audit.LastModifiedAt)
48 {
49 //Branding page has been saved or the file is missing. Rewrite the file to disc.
50 if (brandingPageId > 0)
51 {
52 var brandingPageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(brandingPageId);
53 brandingPageview.Redirect = false;
54 brandingPageview.Output();
55 }
56 }
57
58 if (!cssThemeAndBrandingStyleFileInfo.Exists || cssThemeAndBrandingStyleFileInfo.LastWriteTime < themesParagraphLastChanged.Audit.LastModifiedAt)
59 {
60 //Branding page has been saved or the file is missing. Rewrite the file to disc.
61 if (themePageId > 0)
62 {
63 var themePageview = Dynamicweb.Frontend.PageView.GetPageviewByPageID(themePageId);
64 themePageview.Redirect = false;
65 themePageview.Output();
66 }
67 }
68
69 var cssStyleFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/css/styles.css"));
70 var jsFileInfo = new System.IO.FileInfo(Dynamicweb.Core.SystemInformation.MapPath("/Files/Templates/Designs/Swift/Assets/js/scripts.js"));
71
72 string masterTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("Theme")) ? " theme " + Model.Area.Item.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
73
74 string favicon = Model.Area.Item.GetFile("Favicon") != null ? Model.Area.Item.GetFile("Favicon").Path : "/Files/Templates/Designs/Swift/Assets/Images/favicon.png";
75
76 string headerCssClass = "sticky-top";
77 bool movePageBehind = false;
78
79 if (Pageview.Page.PropertyItem != null)
80 {
81 headerCssClass = Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"] != null ? Pageview.Page.PropertyItem["MoveThisPageBehindTheHeader"].ToString() : "sticky-top";
82 movePageBehind = headerCssClass == "fixed-top" && !Pageview.IsVisualEditorMode ? true : false;
83 }
84
85 headerCssClass = headerCssClass == "" ? "sticky-top" : headerCssClass;
86 headerCssClass = Pageview.IsVisualEditorMode ? "" : headerCssClass;
87
88 string googleTagManagerID = Model.Area.Item.GetString("GoogleTagManagerID");
89 string googleAnalyticsMeasurementID = Model.Area.Item.GetString("GoogleAnalyticsMeasurementID");
90 var cookieOptInLevel = CookieManager.GetCookieOptInLevel();
91 bool allowTracking = cookieOptInLevel == CookieOptInLevel.All || (cookieOptInLevel == CookieOptInLevel.Functional && CookieManager.GetCookieOptInCategories().Contains("Statistical"));
92
93 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/css/styles.css?{cssStyleFileInfo.LastWriteTime.Ticks}>; rel=preload; as=style;");
94 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_{Model.Area.ID}.min.css?{cssLastModified.Ticks}; rel=preload; as=style;");
95 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/aos.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
96 Dynamicweb.Context.Current.Response.AddHeader("link", $"</Files/Templates/Designs/Swift/Assets/js/scripts.js?{jsFileInfo.LastWriteTime.Ticks}; rel=preload; as=script;");
97 //Dynamicweb.Context.Current.Response.Flush(); //This sends the headers where we are now in the rendering making the TTFB faster
98
99 SetMetaTags();
100
101 List<Dynamicweb.Content.Page> languages = new List<Dynamicweb.Content.Page>();
102
103 if (Pageview.Area.IsMaster)
104 {
105 languages.Add(Pageview.Page);
106 if (Pageview.Page.Languages != null)
107 {
108 foreach (var language in Pageview.Page.Languages)
109 {
110 languages.Add(language);
111 }
112 }
113 }
114 else
115 {
116 languages.Add(Pageview.Page.MasterPage);
117 if (Pageview.Page.MasterPage != null)
118 {
119 if (Pageview.Page.MasterPage.Languages != null)
120 {
121 foreach (var language in Pageview.Page.MasterPage.Languages)
122 {
123 languages.Add(language);
124 }
125 }
126 }
127 }
128
129 string siteLanguage = Pageview.Area.CultureInfo.Name;
130 Uri url = Dynamicweb.Context.Current.Request.Url;
131 string hostName = url.Host; // domain.com/da-dk or domain.com/en-us
132
133 var ecomCountries = Dynamicweb.Ecommerce.Services.Countries.GetCountries();
134 var ecomCurrencies = Dynamicweb.Ecommerce.Services.Currencies.GetAllCurrencies();
135 }
136 <!doctype html>
137 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
138 <head>
139 <!-- @swiftVersion -->
140 @* Required meta tags *@
141 <meta charset="utf-8">
142 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
143 <link rel="shortcut icon" href="@favicon">
144 <link rel="apple-touch-icon" href="/Files/Templates/Designs/Swift/Assets/Images/logo_transparent.png">
145
146 @Model.MetaTags
147
148 @{
149 @* Languages meta data *@
150 foreach (var language in languages)
151 {
152 if (language?.Area != null)
153 {
154 if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
155 {
156 if (!string.IsNullOrEmpty(language.Area.DomainLock))
157 {
158 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
159 }
160 string querystring = $"Default.aspx?ID={language.ID}";
161 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"]))
162 {
163 querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}";
164 }
165 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
166 {
167 querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}";
168 }
169 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"]))
170 {
171 querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}";
172 }
173
174 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
175 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
176
177 <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href">
178 }
179 }
180 }
181 }
182
183 <title>@Model.Title</title>
184 @* Bootstrap + Swift stylesheet *@
185 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
186
187 @if (disableWideBreakpoints != "disableBoth")
188 {
189 <style>
190 @@media ( min-width: 1600px ) {
191 .container-xxl,
192 .container-xl,
193 .container-lg,
194 .container-md,
195 .container-sm,
196 .container {
197 max-width: 1520px;
198 }
199 }
200 </style>
201
202
203
204 if (disableWideBreakpoints != "disableUltraWideOnly")
205 {
206 <style>
207 @@media ( min-width: 1920px ) {
208 .container-xxl,
209 .container-xl,
210 .container-lg,
211 .container-md,
212 .container-sm,
213 .container {
214 max-width: 1820px;
215 }
216 }
217 </style>
218 }
219 }
220
221 @* Branding and Themes min stylesheet *@
222 <link href="/Files/Templates/Designs/Swift/_parsed/Swift_css/Swift_styles_@(Model.Area.ID).min.css?@cssLastModified.Ticks" rel="stylesheet" media="all" type="text/css" data-last-modified-content="@cssLastModified">
223 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
224 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
225
226 <script type="module">
227 AOS.init({ duration: 400, delay: 100, easing: 'ease-in-out', mirror: false, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
228 swift.Scroll.hideHeadersOnScroll();
229 swift.Scroll.handleAlternativeTheme();
230 </script>
231
232 <script>
233 document.addEventListener("DOMContentLoaded", function () {
234 document.querySelectorAll("[data-bs-toggle='dropdown']").forEach((dropdownToggle) => {
235 let dropdownMenu = dropdownToggle.nextElementSibling;
236 dropdownToggle.addEventListener("click", function (event) {
237 if (this.tagName.toLowerCase() === "a" && this.href && this.href !== "#") {
238 event.preventDefault();
239 window.location.href = this.href;
240 }
241 });
242 });
243 });
244 </script>
245
246 @* Google tag manager *@
247 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
248 {
249 <script>
250 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
251 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
252 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
253 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
254 })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
255
256 function gtag() { dataLayer.push(arguments); }
257 </script>
258 }
259
260 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID) && allowTracking)
261 {
262 var GoogleAnalyticsDebugMode = "";
263 bool isLoggedInBackendUser = false;
264
265 if (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser() != null)
266 {
267 isLoggedInBackendUser = true;
268 }
269
270 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && isLoggedInBackendUser)
271 {
272 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
273 }
274
275 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
276 <script>
277 window.dataLayer = window.dataLayer || [];
278 function gtag() { dataLayer.push(arguments); }
279 gtag('js', new Date());
280 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
281 </script>
282 }
283
284 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
285 {
286 @RenderPartial($"Components/Custom/{customHeaderInclude}")
287 }
288 </head>
289 <body class="brand @(masterTheme)" id="page@(Model.ID)">
290
291 @* Google tag manager *@
292 @if (!string.IsNullOrWhiteSpace(googleTagManagerID) && allowTracking)
293 {
294 <noscript>
295 <iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)"
296 height="0" width="0" style="display:none;visibility:hidden"></iframe>
297 </noscript>
298 }
299
300 @if (renderAsResponsive || !renderMobile)
301 {
302 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
303 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
304 {
305 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
306 }
307 </header>
308 }
309
310 @if ((renderAsResponsive || renderMobile))
311 {
312 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
313 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
314 {
315 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
316 }
317 </header>
318 }
319
320 <main id="content" @(schemaOrgType)>
321 <div data-intersect></div>
322 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
323 @using System
324 @using Dynamicweb.Ecommerce.ProductCatalog
325
326
327 @{
328 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
329 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
330
331 bool isArticlePagePage = Model.ItemType == "Swift_Article";
332 bool isArticleListPage = Model.ItemType == "Swift_ArticleListPage";
333 string schemaOrgProp = string.Empty;
334 if(isArticlePagePage)
335 {
336 schemaOrgProp = "itemprop=\"articleBody\"";
337 }
338
339 string theme = "";
340 string gridContent = "";
341
342 if (Model.PropertyItem != null)
343 {
344 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? "theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
345 }
346
347 if (Model.Item != null || Pageview.IsVisualEditorMode)
348 {
349 if (!isProductDetail)
350 {
351 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
352 }
353 else
354 {
355 var productObject = Dynamicweb.Ecommerce.Services.Products.GetProductById(productIdFromUrl, "", Pageview.Area.EcomLanguageId);
356 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
357 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
358
359 @RenderGrid(detailPageId)
360 }
361 }
362
363 bool doNotRenderPage = false;
364
365 //Check if we are on the poduct detail page, and if there is data to render
366 ProductViewModel product = new ProductViewModel();
367 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
368 {
369 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
370 if (string.IsNullOrEmpty(product.Id)) {
371 doNotRenderPage = true;
372 }
373 }
374
375 //Render the page
376 if (!doNotRenderPage) {
377 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
378
379
380 <div class="@theme @itemIdentifier" @schemaOrgProp>
381 @if (isArticleListPage)
382 {
383 var hx = $"hx-get=\"{Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(Model.ID)}\" hx-select=\"#content\" hx-target=\"#content\" hx-swap=\"outerHTML\" hx-trigger=\"change\" hx-headers='{{\"feed\": \"true\"}}' hx-push-url=\"true\" hx-indicator=\"#ArticleFacetForm\"";
384
385 <form @hx id="ArticleFacetForm">
386 @gridContent
387 </form>
388 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/htmx.js"></script>
389 <script type="module">
390 document.addEventListener('htmx:confirm', (event) => {
391 let filters = event.detail.elt.querySelectorAll('select');
392 for (var i = 0; i < filters.length; i++) {
393 let input = filters[i];
394 if (input.name && !input.value) {
395 input.name = '';
396 }
397 }
398 });
399
400 document.addEventListener('htmx:beforeOnLoad', (event) => {
401 swift.Scroll.stopIntersectionObserver();
402 });
403
404 document.addEventListener('htmx:afterOnLoad', () => {
405 swift.Scroll.hideHeadersOnScroll();
406 swift.Scroll.handleAlternativeTheme();
407 });
408 </script>
409 }
410 else
411 {
412 @gridContent
413 }
414 </div>
415
416 } else {
417 <div class="container">
418 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
419 </div>
420 }
421
422 if (!Model.IsCurrentUserAllowed)
423 {
424 int signInPage = GetPageIdByNavigationTag("SignInPage");
425 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
426
427 if (!Pageview.IsVisualEditorMode)
428 {
429 if (signInPage != 0)
430 {
431 if (signInPage != Model.ID) {
432 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
433 } else {
434 if (dashboardPage != 0) {
435 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
436 } else {
437 Dynamicweb.Context.Current.Response.Redirect("/");
438 }
439 }
440 }
441 else
442 {
443 <div class="alert alert-dark m-0" role="alert">
444 <span>@Translate("You do not have access to this page")</span>
445 </div>
446 }
447 }
448 else
449 {
450 <div class="alert alert-dark m-0" role="alert">
451 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
452 </div>
453 }
454 }
455 }
456
457 </main>
458
459 @if (renderAsResponsive || !renderMobile)
460 {
461 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
462 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
463 {
464 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
465 }
466 </footer>
467 }
468
469 @if (renderAsResponsive || renderMobile)
470 {
471 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
472 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
473 {
474 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
475 }
476 </footer>
477 }
478
479 @* Render any offcanvas menu here *@
480 @RenderSnippet("offcanvas")
481
482 @{
483 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]);
484 }
485
486 @* Language selector modal *@
487 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
488 {
489 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
490 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
491 @* The content here comes from an external request *@
492 </div>
493 </div>
494 }
495
496 @* Favorite toast *@
497 <div aria-live="polite" aria-atomic="true">
498 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
499 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
500 <div class="toast-header">
501 <strong class="me-auto">@Translate("Favorite list updated")</strong>
502 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
503 </div>
504 <div class="toast-body d-flex gap-3">
505 <div id="favoriteNotificationToast_Image"></div>
506 <div id="favoriteNotificationToast_Text"></div>
507 </div>
508 </div>
509 </div>
510 </div>
511
512 @* Modal for dynamic content *@
513 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
514 <div class="modal-dialog modal-dialog-centered modal-md">
515 <div class="modal-content theme light" id="DynamicModalContent">
516 @* The content here comes from an external request *@
517 </div>
518 </div>
519 </div>
520
521 @* Offcanvas for dynamic content *@
522 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
523 @* The content here comes from an external request *@
524 </div>
525
526 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
527 {
528 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
529
530 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
531 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
532 <div class="toast-header">
533 <strong class="me-auto">@Translate("Connection down")</strong>
534 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
535 </div>
536 <div class="toast-body">
537 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
538 </div>
539 </div>
540 </div>
541 }
542 </body>
543 </html>
544 @functions {
545 void SetMetaTags()
546 {
547 //Verification Tokens
548 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
549 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
550 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
551 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
552 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
553 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
554
555 //Generic Site Values
556 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
557 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
558 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
559
560 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
561
562 //Page specific values
563 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
564 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
565 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
566 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
567
568 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
569 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
570 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
571 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
572 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
573
574 if (!string.IsNullOrEmpty(siteVerificationGoogle))
575 {
576 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
577 }
578
579 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
580 {
581 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
582 }
583
584 if (!string.IsNullOrEmpty(openGraphType))
585 {
586 Pageview.Meta.AddTag("og:type", openGraphType);
587 }
588
589 if (!string.IsNullOrEmpty(openGraphSiteName))
590 {
591 Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
592 }
593
594 if (!string.IsNullOrEmpty(Model.Title))
595 {
596 Pageview.Meta.AddTag("og:title", Model.Title);
597 }
598 else
599 {
600 Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
601 }
602
603 if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
604 {
605 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
606 }
607
608 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
609 {
610 if (!string.IsNullOrEmpty(Model.Description))
611 {
612 Pageview.Meta.AddTag("og:description", Model.Description);
613 }
614 else
615 {
616 Pageview.Meta.AddTag("og:description", openGraphDescription);
617 }
618 if (openGraphImage != null)
619 {
620 Pageview.Meta.AddTag("og:image", openGraphImage.Path);
621 }
622
623 if (!string.IsNullOrEmpty(openGraphImageALT))
624 {
625 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
626 }
627 if (!string.IsNullOrEmpty(twitterCardDescription))
628 {
629 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
630 }
631
632 if (twitterCardImage != null)
633 {
634 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
635 }
636
637 if (!string.IsNullOrEmpty(twitterCardImageALT))
638 {
639 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
640 }
641 }
642
643 if (!string.IsNullOrEmpty(twitterCardSite))
644 {
645 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
646 }
647
648 if (!string.IsNullOrEmpty(twitterCardURL))
649 {
650 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
651 }
652
653 if (!string.IsNullOrEmpty(twitterCardTitle))
654 {
655 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
656 }
657 }
658 }
659