Error executing template "Designs/Swift/_parsed/Swift_Page_custom.parsed.cshtml"
System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'S_DW_Expotape'. Reason: Server is in single user mode. Only one administrator can connect at this time.
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_597877b776544cacaa5b443fd413827d.Execute() in D:\dynamicweb.net\Solutions\S_DW_Expotape\Files\Templates\Designs\Swift\_parsed\Swift_Page_custom.parsed.cshtml:line 349
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:0f42fa79-846d-44c6-af02-da119e22cbcb
Error Number:18461,State:1,Class:14
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 // START CUSTOM BLOCK
137 string googleIconPath = S_DW_Expotape.Custom_Code.Helpers.CustomSettingsHelper.GetValue<string>("GoogleIcon");
138 // END CUSTOM BLOCK
139 }
140 <!doctype html>
141 <html lang="@Pageview.Area.CultureInfo.TwoLetterISOLanguageName">
142 <head>
143 <!-- @swiftVersion -->
144 @* Required meta tags *@
145 <meta charset="utf-8">
146 <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0">
147 <link rel="shortcut icon" href="@favicon">
148 @if (!string.IsNullOrEmpty(googleIconPath))
149 {
150 <link rel="apple-touch-icon" href="@googleIconPath">
151 }
152 <link href="/assets/styles/main-min.css" rel="stylesheet" type="text/css">
153 @Model.MetaTags
154
155 @{
156 @* Languages meta data *@
157 foreach (var language in languages)
158 {
159 if (language?.Area != null)
160 {
161 if (language != null && language.Published && language.Active && language.Area.Active && language.Area.Published && language.Area.ID != Dynamicweb.Frontend.PageView.Current().AreaID)
162 {
163 if (!string.IsNullOrEmpty(language.Area.DomainLock))
164 {
165 hostName = language.Area.DomainLock; //dk.domain.com or dk-domain.dk
166 }
167 string querystring = $"Default.aspx?ID={language.ID}";
168 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["GroupID"]))
169 {
170 querystring += $"&GroupID={Dynamicweb.Context.Current.Request.QueryString["GroupID"]}";
171 }
172 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
173 {
174 querystring += $"&ProductID={Dynamicweb.Context.Current.Request.QueryString["ProductID"]}";
175 }
176 if (!string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["VariantID"]))
177 {
178 querystring += $"&VariantID={Dynamicweb.Context.Current.Request.QueryString["VariantID"]}";
179 }
180
181 string friendlyUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(querystring);
182 string href = $"{url.Scheme}://{hostName}{friendlyUrl}";
183
184 <link rel="alternate" hreflang="@language.Area.CultureInfo.Name.ToLower()" href="@href">
185 }
186 }
187 }
188 }
189
190 <title>@Model.Title</title>
191 @* Bootstrap + Swift stylesheet *@
192 <link href="/Files/Templates/Designs/Swift/Assets/css/styles.css?@cssStyleFileInfo.LastWriteTime.Ticks" rel="stylesheet" media="all" type="text/css">
193
194 @if (disableWideBreakpoints != "disableBoth")
195 {
196 <style>
197 @@media ( min-width: 1600px ) {
198 .container-xxl,
199 .container-xl,
200 .container-lg,
201 .container-md,
202 .container-sm,
203 .container {
204 max-width: 1520px;
205 }
206 }
207 </style>
208
209
210
211 if (disableWideBreakpoints != "disableUltraWideOnly")
212 {
213 <style>
214 @@media ( min-width: 1920px ) {
215 .container-xxl,
216 .container-xl,
217 .container-lg,
218 .container-md,
219 .container-sm,
220 .container {
221 max-width: 1820px;
222 }
223 }
224 </style>
225 }
226 }
227
228 @* Branding and Themes min stylesheet *@
229 <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">
230 <script src="/Files/Templates/Designs/Swift/Assets/js/aos.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
231 <script src="/Files/Templates/Designs/Swift/Assets/js/scripts.js?@jsFileInfo.LastWriteTime.Ticks" defer></script>
232
233 <script type="module">
234 AOS.init({ duration: 400, delay: 100, easing: 'ease-in-out', mirror: false, disable: window.matchMedia('(prefers-reduced-motion: reduce)') });
235 swift.Scroll.hideHeadersOnScroll();
236 swift.Scroll.handleAlternativeTheme();
237 </script>
238
239 @* Google tag manager *@
240 @if (!string.IsNullOrWhiteSpace(googleTagManagerID))
241 {
242 <script>
243 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
244 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
245 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
246 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
247 })(window, document, 'script', 'dataLayer', '@(googleTagManagerID)');
248
249 function gtag() { dataLayer.push(arguments); }
250 </script>
251 }
252
253 @if (!string.IsNullOrWhiteSpace(googleAnalyticsMeasurementID))
254 {
255 var GoogleAnalyticsDebugMode = "";
256 bool isLoggedInBackendUser = false;
257
258 if (Dynamicweb.Security.UserManagement.User.GetCurrentBackendUser() != null)
259 {
260 isLoggedInBackendUser = true;
261 }
262
263 if (Model.Area.Item.GetBoolean("EnableGoogleAnalyticsDebugMode") && isLoggedInBackendUser)
264 {
265 GoogleAnalyticsDebugMode = ", {'debug_mode': true}";
266 }
267
268 <script async src="https://www.googletagmanager.com/gtag/js?id=@googleAnalyticsMeasurementID"></script>
269 <script>
270 window.dataLayer = window.dataLayer || [];
271 function gtag() { dataLayer.push(arguments); }
272 gtag('js', new Date());
273 gtag('config', '@googleAnalyticsMeasurementID'@GoogleAnalyticsDebugMode);
274 </script>
275 }
276
277 @if (!string.IsNullOrWhiteSpace(customHeaderInclude))
278 {
279 @RenderPartial($"Components/Custom/{customHeaderInclude}")
280 }
281 <script src="assets/scripts/main-min.js" defer></script>
282 </head>
283 <body class="brand @(masterTheme)" id="page@(Model.ID)">
284
285 @* Google tag manager *@
286 @if (!string.IsNullOrWhiteSpace(googleTagManagerID))
287 {
288 <noscript>
289 <iframe src="https://www.googletagmanager.com/ns.html?id=@(googleTagManagerID)"
290 height="0" width="0" style="display:none;visibility:hidden"></iframe>
291 </noscript>
292 }
293
294 @if (renderAsResponsive || !renderMobile)
295 {
296 <header class="page-header @headerCssClass top-0@(responsiveClassDesktop)" id="page-header-desktop">
297 @if (@Model.Area.Item.GetLink("HeaderDesktop") != null)
298 {
299 @RenderGrid(@Model.Area.Item.GetLink("HeaderDesktop").PageId)
300 }
301 </header>
302 }
303
304 @if ((renderAsResponsive || renderMobile))
305 {
306 <header class="page-header @headerCssClass top-0@(responsiveClassMobile)" id="page-header-mobile">
307 @if (@Model.Area.Item.GetLink("HeaderMobile") != null)
308 {
309 @RenderGrid(@Model.Area.Item.GetLink("HeaderMobile").PageId)
310 }
311 </header>
312 }
313
314 <main id="content" @(schemaOrgType)>
315 <div data-intersect></div>
316 @inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
317 @using System
318 @using Dynamicweb.Ecommerce.ProductCatalog
319
320
321 @{
322 string productIdFromUrl = !string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString.Get("ProductID")) ? Dynamicweb.Context.Current.Request.QueryString.Get("ProductID") : string.Empty;
323 bool isProductDetail = !string.IsNullOrEmpty(productIdFromUrl) && Pageview.Page.NavigationTag.ToLower() == "shop";
324
325 bool isArticlePagePage = Model.ItemType == "Swift_Article";
326 bool isArticleListPage = Model.ItemType == "Swift_ArticleListPage";
327 string schemaOrgProp = string.Empty;
328 if (isArticlePagePage)
329 {
330 schemaOrgProp = "itemprop=\"articleBody\"";
331 }
332
333 string theme = "";
334 string gridContent = "";
335
336 if (Model.PropertyItem != null)
337 {
338 theme = !string.IsNullOrWhiteSpace(Model.PropertyItem.GetRawValueString("Theme")) ? "theme " + Model.PropertyItem.GetRawValueString("Theme").Replace(" ", "").Trim().ToLower() : "";
339 }
340
341 if (Model.Item != null || Pageview.IsVisualEditorMode)
342 {
343 if (!isProductDetail)
344 {
345 gridContent = Model.Grid("Grid", "Grid", "default:true;sort:1", "Page");
346 }
347 else
348 {
349 var productObject = Dynamicweb.Ecommerce.Services.Products.GetProductById(productIdFromUrl, "", Pageview.Area.EcomLanguageId);
350 var detailPage = Dynamicweb.Ecommerce.Services.ProductGroups.GetGroup(productObject.PrimaryGroupId)?.Meta.PrimaryPage ?? string.Empty;
351 var detailPageId = detailPage != string.Empty ? Convert.ToInt16(detailPage.Substring(detailPage.LastIndexOf('=') + 1)) : GetPageIdByNavigationTag("ProductDetailPage");
352
353 @RenderGrid(detailPageId)
354 }
355 }
356
357 bool doNotRenderPage = false;
358
359 //Check if we are on the poduct detail page, and if there is data to render
360 ProductViewModel product = new ProductViewModel();
361 if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
362 {
363 product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
364 if (string.IsNullOrEmpty(product.Id))
365 {
366 doNotRenderPage = true;
367 }
368 }
369
370 //Render the page
371 if (!doNotRenderPage)
372 {
373 string itemIdentifier = Model?.Item?.SystemName != null ? "item_" + Model.Item.SystemName.ToLower() : "item_Swift_Page";
374
375
376 <div class="@theme @itemIdentifier" @schemaOrgProp>
377 @if (isArticleListPage)
378 {
379 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\"";
380
381 <form @hx id="ArticleFacetForm">
382 @gridContent
383 </form>
384 <script type="module" src="/Files/Templates/Designs/Swift/Assets/js/htmx.js"></script>
385 <script type="module">
386 document.addEventListener('htmx:confirm', (event) => {
387 let filters = event.detail.elt.querySelectorAll('select');
388 for (var i = 0; i < filters.length; i++) {
389 let input = filters[i];
390 if (input.name && !input.value) {
391 input.name = '';
392 }
393 }
394 });
395
396 document.addEventListener('htmx:beforeOnLoad', (event) => {
397 swift.Scroll.stopIntersectionObserver();
398 });
399
400 document.addEventListener('htmx:afterOnLoad', () => {
401 swift.Scroll.hideHeadersOnScroll();
402 swift.Scroll.handleAlternativeTheme();
403 });
404 </script>
405 }
406 else
407 {
408 @gridContent
409 }
410 </div>
411
412 }
413 else
414 {
415 <div class="container">
416 <div class="alert alert-info" role="alert">@Translate("Sorry. There is nothing to view here")</div>
417 </div>
418 }
419
420 if (!Model.IsCurrentUserAllowed)
421 {
422 int signInPage = GetPageIdByNavigationTag("SignInPage");
423 int dashboardPage = GetPageIdByNavigationTag("MyAccountDashboardPage");
424
425 if (!Pageview.IsVisualEditorMode)
426 {
427 if (signInPage != 0)
428 {
429 if (signInPage != Model.ID)
430 {
431 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + signInPage);
432 }
433 else
434 {
435 if (dashboardPage != 0)
436 {
437 Dynamicweb.Context.Current.Response.Redirect("/Default.aspx?ID=" + dashboardPage);
438 }
439 else
440 {
441 Dynamicweb.Context.Current.Response.Redirect("/");
442 }
443 }
444 }
445 else
446 {
447 <div class="alert alert-dark m-0" role="alert">
448 <span>@Translate("You do not have access to this page")</span>
449 </div>
450 }
451 }
452 else
453 {
454 <div class="alert alert-dark m-0" role="alert">
455 <span>@Translate("To work on this page, you must be signed in, in the frontend")</span>
456 </div>
457 }
458 }
459 }
460
461 </main>
462
463 @if (renderAsResponsive || !renderMobile)
464 {
465 <footer class="page-footer@(responsiveClassDesktop)" id="page-footer-desktop">
466 @if (@Model.Area.Item.GetLink("FooterDesktop") != null)
467 {
468 @RenderGrid(@Model.Area.Item.GetLink("FooterDesktop").PageId)
469 }
470 </footer>
471 }
472
473 @if (renderAsResponsive || renderMobile)
474 {
475 <footer class="page-footer@(responsiveClassMobile)" id="page-footer-mobile">
476 @if (@Model.Area.Item.GetLink("FooterMobile") != null)
477 {
478 @RenderGrid(@Model.Area.Item.GetLink("FooterMobile").PageId)
479 }
480 </footer>
481 }
482
483 @* Render any offcanvas menu here *@
484 @RenderSnippet("offcanvas")
485
486 @{
487 bool isErpConnectionDown = !Dynamicweb.Core.Converter.ToBoolean(Context.Current.Items["IsWebServiceConnectionAvailable"]);
488 }
489
490 @* Language selector modal *@
491 @if (languages.Count > 1 || ecomCountries.Count > 1 || ecomCurrencies.Count() > 1)
492 {
493 <div class="modal fade" id="PreferencesModal" tabindex="-1" aria-hidden="true">
494 <div class="modal-dialog modal-dialog-centered modal-sm" id="PreferencesModalContent">
495 @* The content here comes from an external request *@
496 </div>
497 </div>
498 }
499
500 @* Favorite toast *@
501 <div aria-live="polite" aria-atomic="true">
502 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 11">
503 <div id="favoriteNotificationToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
504 <div class="toast-header">
505 <strong class="me-auto">@Translate("Favorite list updated")</strong>
506 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
507 </div>
508 <div class="toast-body d-flex gap-3">
509 <div id="favoriteNotificationToast_Image"></div>
510 <div id="favoriteNotificationToast_Text"></div>
511 </div>
512 </div>
513 </div>
514 </div>
515
516 @* Modal for dynamic content *@
517 <div class="modal fade js-product" id="DynamicModal" tabindex="-1" aria-hidden="true">
518 <div class="modal-dialog modal-dialog-centered modal-md">
519 <div class="modal-content theme light" id="DynamicModalContent">
520 @* The content here comes from an external request *@
521 </div>
522 </div>
523 </div>
524
525 @* Offcanvas for dynamic content *@
526 <div class="offcanvas offcanvas-end theme light" tabindex="-1" id="DynamicOffcanvas" style="width: 30rem">
527 @* The content here comes from an external request *@
528 </div>
529
530 @if (isErpConnectionDown && Model.Area.Item.GetBoolean("ShowErpDownMessage"))
531 {
532 string erpDownMessageTheme = !string.IsNullOrWhiteSpace(Model.Area.Item.GetRawValueString("ErpDownMessageTheme")) ? " theme " + Model.Area.Item.GetRawValueString("ErpDownMessageTheme").Replace(" ", "").Trim().ToLower() : "theme light";
533
534 <div class="position-fixed bottom-0 end-0 p-3" style="z-index: 1040">
535 <div class="toast fade show border-0 @erpDownMessageTheme" role="alert" aria-live="assertive" aria-atomic="true">
536 <div class="toast-header">
537 <strong class="me-auto">@Translate("Connection down")</strong>
538 <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
539 </div>
540 <div class="toast-body">
541 @Translate("We are experiencing some connectivity issues. Not all features may be available to you.")
542 </div>
543 </div>
544 </div>
545 }
546 </body>
547 </html>
548 @functions {
549 void SetMetaTags()
550 {
551 //Verification Tokens
552 string siteVerificationGoogle = Model.Area.Item.GetString("Google_Site_Verification") != null ? Model.Area.Item.GetString("Google_Site_Verification") : "";
553 //string siteVerificationYandex = Model.Area.Item.GetString("Yandex_Verification") != null ? Model.Area.Item.GetString("Yandex_Verification") : "";
554 //string siteVerificationMS = Model.Area.Item.GetString("Msvalidate_01") != null ? Model.Area.Item.GetString("Msvalidate_01") : "";
555 //string siteVerificationAlexa = Model.Area.Item.GetString("AlexaVerifyID") != null ? Model.Area.Item.GetString("AlexaVerifyID") : "";
556 //string siteVerificationPinterest = Model.Area.Item.GetString("P_domain_verify") != null ? Model.Area.Item.GetString("P_domain_verify") : "";
557 //string siteVerificationNorton = Model.Area.Item.GetString("Norton_safeweb_site_verification") != null ? Model.Area.Item.GetString("Norton_safeweb_site_verification") : "";
558
559 //Generic Site Values
560 string openGraphFacebookAppID = Model.Area.Item.GetString("Fb_app_id") != null ? Model.Area.Item.GetString("Fb_app_id") : "";
561 string openGraphType = Model.Area.Item.GetString("Open_Graph_Type") != null ? Model.Area.Item.GetString("Open_Graph_Type") : "";
562 string openGraphSiteName = Model.Area.Item.GetString("Open_Graph_Site_Name") != null ? Model.Area.Item.GetString("Open_Graph_Site_Name") : "";
563
564 string twitterCardSite = Model.Area.Item.GetString("Twitter_Site") != null ? Model.Area.Item.GetString("Twitter_Site") : "";
565
566 //Page specific values
567 string openGraphSiteTitle = Model.Area.Item.GetString("Open_Graph_Title") != null ? Model.Area.Item.GetString("Open_Graph_Title") : "";
568 FileViewModel openGraphImage = Model.Area.Item.GetFile("Open_Graph_Image");
569 string openGraphImageALT = Model.Area.Item.GetString("Open_Graph_Image_ALT") != null ? Model.Area.Item.GetString("Open_Graph_Image_ALT") : "";
570 string openGraphDescription = Model.Area.Item.GetString("Open_Graph_Description") != null ? Model.Area.Item.GetString("Open_Graph_Description") : "";
571
572 string twitterCardURL = Model.Area.Item.GetString("Twitter_URL") != null ? Model.Area.Item.GetString("Twitter_URL") : "";
573 string twitterCardTitle = Model.Area.Item.GetString("Twitter_Title") != null ? Model.Area.Item.GetString("Twitter_Title") : "";
574 string twitterCardDescription = Model.Area.Item.GetString("Twitter_Description") != null ? Model.Area.Item.GetString("Twitter_Description") : "";
575 FileViewModel twitterCardImage = Model.Area.Item.GetFile("Twitter_Image");
576 string twitterCardImageALT = Model.Area.Item.GetString("Twitter_Image_ALT") != null ? Model.Area.Item.GetString("Twitter_Image_ALT") : "";
577
578 if (!string.IsNullOrEmpty(siteVerificationGoogle))
579 {
580 Pageview.Meta.AddTag("google-site-verification", siteVerificationGoogle);
581 }
582
583 if (!string.IsNullOrEmpty(openGraphFacebookAppID))
584 {
585 Pageview.Meta.AddTag("fb:app_id", openGraphFacebookAppID);
586 }
587
588 if (!string.IsNullOrEmpty(openGraphType))
589 {
590 Pageview.Meta.AddTag("og:type", openGraphType);
591 }
592
593 if (!string.IsNullOrEmpty(openGraphSiteName))
594 {
595 Pageview.Meta.AddTag("og:site_name", openGraphSiteName);
596 }
597
598 if (!string.IsNullOrEmpty(Model.Title))
599 {
600 Pageview.Meta.AddTag("og:title", Model.Title);
601 }
602 else
603 {
604 Pageview.Meta.AddTag("og:title", openGraphSiteTitle);
605 }
606
607 if (!string.IsNullOrEmpty(Pageview.Page.TopImage) && openGraphImage == null)
608 {
609 Pageview.Meta.AddTag("og:image", Dynamicweb.Context.Current.Request.Url.Scheme + "://" + Dynamicweb.Context.Current.Request.Url.Host + Pageview.Page.TopImage);
610 }
611
612 if (string.IsNullOrEmpty(Dynamicweb.Context.Current.Request.QueryString["ProductID"]))
613 {
614 if (!string.IsNullOrEmpty(Model.Description))
615 {
616 Pageview.Meta.AddTag("og:description", Model.Description);
617 }
618 else
619 {
620 Pageview.Meta.AddTag("og:description", openGraphDescription);
621 }
622 if (openGraphImage != null)
623 {
624 Pageview.Meta.AddTag("og:image", openGraphImage.Path);
625 }
626
627 if (!string.IsNullOrEmpty(openGraphImageALT))
628 {
629 Pageview.Meta.AddTag("og:image:alt", openGraphImageALT);
630 }
631 if (!string.IsNullOrEmpty(twitterCardDescription))
632 {
633 Pageview.Meta.AddTag("twitter:description", twitterCardDescription);
634 }
635
636 if (twitterCardImage != null)
637 {
638 Pageview.Meta.AddTag("twitter:image", twitterCardImage.Path);
639 }
640
641 if (!string.IsNullOrEmpty(twitterCardImageALT))
642 {
643 Pageview.Meta.AddTag("twitter:image:alt", twitterCardImageALT);
644 }
645 }
646
647 if (!string.IsNullOrEmpty(twitterCardSite))
648 {
649 Pageview.Meta.AddTag("twitter:site", twitterCardSite);
650 }
651
652 if (!string.IsNullOrEmpty(twitterCardURL))
653 {
654 Pageview.Meta.AddTag("twitter:url", twitterCardURL);
655 }
656
657 if (!string.IsNullOrEmpty(twitterCardTitle))
658 {
659 Pageview.Meta.AddTag("twitter:title", twitterCardTitle);
660 }
661 }
662 }
663