Fix comportamento http/httpsd (da provare)

This commit is contained in:
Samuele Locatelli
2022-02-19 12:49:35 +01:00
parent 0af14f59cf
commit ea2e866648
4 changed files with 35 additions and 23 deletions
+14 -13
View File
@@ -1,16 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="MoonProConnectionString" value="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="PermessiConnectionString" value="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="UtenteCdcConnectionString" value="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro_Anagrafica;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="VocabolarioConnectionString" value="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro_Vocabolario;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
<connectionStrings>
<add name="MoonProConnectionString" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
<add name="MapoDb.Properties.Settings.MoonProConnectionString" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
<appSettings>
<add key="forceHttps" value="false" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="MoonProConnectionString" value="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="PermessiConnectionString" value="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="UtenteCdcConnectionString" value="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro_Anagrafica;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
<add key="VocabolarioConnectionString" value="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro_Vocabolario;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
<connectionStrings>
<add name="MoonProConnectionString" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
<add name="MapoDb.Properties.Settings.MoonProConnectionString" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=MoonPro;Persist Security Info=True;User ID=sa;Password=viadante16;" xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
</connectionStrings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
+6 -3
View File
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
<appSettings>
<add key="forceHttps" value="false" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)" />
</system.web>
</configuration>
+1
View File
@@ -49,6 +49,7 @@
<add key="_logDir" value="~/logs/" />
<add key="logMitigSec" value="30" />
<add key="sendParamLegacy" value="false" />
<add key="forceHttps" value="true" />
<!--gestione timeout "esteso" x chiamate SQL critiche, in secondi -->
<add key="sqlLongCommandTimeout" value="600" />
<!--stringhe connessione SQL2016-->
+14 -7
View File
@@ -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
}
}
}