From ea2e86664801c5c45007ac248ac925e649800f43 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 19 Feb 2022 12:49:35 +0100 Subject: [PATCH] Fix comportamento http/httpsd (da provare) --- MP-TAB/Web.Prod.config | 27 ++++++++++--------- MP-TAB/Web.Release.config | 9 ++++--- MP-TAB/Web.config | 1 + MP-TAB/WebUserControls/mod_checkHttps.ascx.cs | 21 ++++++++++----- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/MP-TAB/Web.Prod.config b/MP-TAB/Web.Prod.config index 014c369e..b44fcc63 100644 --- a/MP-TAB/Web.Prod.config +++ b/MP-TAB/Web.Prod.config @@ -1,16 +1,17 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MP-TAB/Web.Release.config b/MP-TAB/Web.Release.config index c93c6701..dcae2e8c 100644 --- a/MP-TAB/Web.Release.config +++ b/MP-TAB/Web.Release.config @@ -1,6 +1,9 @@  - - - + + + + + + \ No newline at end of file diff --git a/MP-TAB/Web.config b/MP-TAB/Web.config index f2933020..a2357392 100644 --- a/MP-TAB/Web.config +++ b/MP-TAB/Web.config @@ -49,6 +49,7 @@ + diff --git a/MP-TAB/WebUserControls/mod_checkHttps.ascx.cs b/MP-TAB/WebUserControls/mod_checkHttps.ascx.cs index 07a6d3c1..1bf70356 100644 --- a/MP-TAB/WebUserControls/mod_checkHttps.ascx.cs +++ b/MP-TAB/WebUserControls/mod_checkHttps.ascx.cs @@ -14,16 +14,24 @@ namespace MoonProTablet.WebUserControls { if (!Page.IsPostBack) { -#if DEBUG - // in debug NON gestisco cambio http/https... - - -#else // SOLO SE è abilitato QR reader... if (memLayer.ML.CRB("EmbedQRead")) { +#if DEBUG + // in debug NON gestisco cambio http/https... + bool needHttps = true; + + +#else + // se è FORZATO da web.config + bool forceHttps = memLayer.ML.CRB("forceHttps"); + // se è FQND: iis01.egalware.com lo è, iis01 NO... + bool isFQDN = Request.Url.Host.IndexOf(".") > 0; // se pagina richiesta in http ma con QR code rimando in https... - bool needHttps = memLayer.ML.CRS("forceSecurePages").IndexOf(titolo) >= 0; + bool isSecuredPage = memLayer.ML.CRS("forceSecurePages").IndexOf(titolo) >= 0; + + bool needHttps = forceHttps || isFQDN || isSecuredPage; +#endif if (needHttps != Request.IsSecureConnection) { string newUrl = Request.Url.AbsoluteUri; @@ -39,7 +47,6 @@ namespace MoonProTablet.WebUserControls Response.Redirect(newUrl); } } -#endif } } }