Fixed redirect (maybe)

This commit is contained in:
Samuele E. Locatelli
2019-10-12 09:05:46 +02:00
parent 5bc2c57ccb
commit 70a466b09c
3 changed files with 99 additions and 27 deletions
+9 -4
View File
@@ -1,5 +1,6 @@
using SteamWare;
using System;
using System.Threading;
namespace GPW_Smart
{
@@ -7,10 +8,14 @@ namespace GPW_Smart
{
protected void Page_Load(object sender, EventArgs e)
{
logger.lg.scriviLog(string.Format("Errore sollevato dalla pag {0} (prev: {1})", user_std.pagCorrente, user_std.pagPrecedente), tipoLog.INFO);
memLayer.ML.setSessionVal("nextPage", "Default");
memLayer.ML.setSessionVal("pagPrecedente", user_std.pagCorrente);
Response.Redirect(memLayer.ML.confReadString("errorPageRedirect"));
string currPage = user_std.pagCorrente != "" ? user_std.pagCorrente : "Default";
string prevPage = user_std.pagPrecedente != "" ? user_std.pagPrecedente : "Default";
string errorPageRedirect = memLayer.ML.confReadString("errorPageRedirect");
memLayer.ML.setSessionVal("nextPage", currPage);
memLayer.ML.setSessionVal("pagPrecedente", prevPage);
logger.lg.scriviLog($"ErrorPage chiamata: currPage {currPage} | currPage: {currPage} --> Redirect a {errorPageRedirect}", tipoLog.INFO);
Thread.Sleep(50);
Response.Redirect(errorPageRedirect);
}
}
}
+60 -20
View File
@@ -18,42 +18,82 @@ namespace GPW_Smart
if (action.Contains("C"))
{
recPrev = Cache.Count;
// reset dati in cache...
memLayer.ML.flushRegisteredCache();
recPost = Cache.Count;
testo += string.Format("<hr/>Reset Cache: {0} --> {1}</br>", recPrev, recPost);
if (recPrev > 0)
{
try
{
// reset dati in cache...
memLayer.ML.flushRegisteredCache();
recPost = Cache.Count;
testo += string.Format("<hr/>Reset Cache: {0} --> {1}</br>", recPrev, recPost);
}
catch
{ }
}
}
if (action.Contains("D"))
{
recPrev = memLayer.ML.numRecAppConf;
// reset dati in cache x DbConfig...
memLayer.ML.resetAppConf();
recPost = memLayer.ML.numRecAppConf;
testo += string.Format("<hr/>Reset DB AppConf: {0} --> {1}</br>", recPrev, recPost);
if (recPrev > 0)
{
try
{
// reset dati in cache x DbConfig...
memLayer.ML.resetAppConf();
recPost = memLayer.ML.numRecAppConf;
testo += string.Format("<hr/>Reset DB AppConf: {0} --> {1}</br>", recPrev, recPost);
}
catch
{ }
}
}
if (action.Contains("R"))
{
recPrev = memLayer.ML.numRecRedis;
// reset dati in cache x DbConfig...
memLayer.ML.redFlushKey("**");
recPost = memLayer.ML.numRecRedis;
testo += string.Format("<hr/>Reset Redis: {0} --> {1}</br>", recPrev, recPost);
if (recPrev > 0)
{
try
{
// reset dati in cache x DbConfig...
memLayer.ML.redFlushKey("**");
recPost = memLayer.ML.numRecRedis;
testo += string.Format("<hr/>Reset Redis: {0} --> {1}</br>", recPrev, recPost);
}
catch
{ }
}
}
if (action.Contains("S"))
{
recPrev = Session.Count;
// reset dati in sessione...
Session.Clear();
recPost = Session.Count;
testo += string.Format("<hr/>Reset Sessione: {0} --> {1}</br>", recPrev, recPost);
if (recPrev > 0)
{
try
{
// reset dati in sessione...
Session.Clear();
recPost = Session.Count;
testo += string.Format("<hr/>Reset Sessione: {0} --> {1}</br>", recPrev, recPost);
}
catch
{ }
}
}
if (action.Contains("V"))
{
recPrev = DataWrap.DW.numRecVoc;
// aggiorno vocabolario
DataWrap.DW.resetVocabolario();
recPost = DataWrap.DW.numRecVoc;
testo += string.Format("<hr/>Reset Vocabolario: {0} --> {1}</br>", recPrev, recPost);
if (recPrev > 0)
{
try
{
// aggiorno vocabolario
DataWrap.DW.resetVocabolario();
recPost = DataWrap.DW.numRecVoc;
testo += string.Format("<hr/>Reset Vocabolario: {0} --> {1}</br>", recPrev, recPost);
}
catch
{ }
}
}
}
lblOut.Text = testo;
+30 -3
View File
@@ -36,6 +36,7 @@ namespace GPW_Smart.WebUserControls
{
if (!Page.IsPostBack)
{
checkPages();
searchVal = "";
ulLinks.DataBind();
}
@@ -55,6 +56,29 @@ namespace GPW_Smart.WebUserControls
lblSwData.Text = "GPW";
}
}
/// <summary>
/// Verifica le pagine x capire se siano cambiate...
/// </summary>
private void checkPages()
{
if (nomePagina != user_std.pagCorrente)
{
user_std.pagPrecedente = user_std.pagCorrente != "" ? user_std.pagCorrente : nomePagina;
user_std.pagCorrente = nomePagina;
}
}
/// <summary>
/// Nome pagina (parte finale url)
/// </summary>
public string nomePagina
{
get
{
return devicesAuthProxy.getPage(Request.Url).Replace(".aspx", "");
}
}
/// <summary>
/// verifica presenza utente autorizzato in sessione
/// </summary>
@@ -201,12 +225,14 @@ namespace GPW_Smart.WebUserControls
public string cssActive(string pageName)
{
string answ = "";
if (pageName == PagCorrente())
//if (pageName == PagCorrente())
if (pageName == nomePagina)
{
answ = "active";
}
return answ;
}
#if false
/// <summary>
/// salva in variabile pagina il nome della pagina corrente
/// </summary>
@@ -220,11 +246,12 @@ namespace GPW_Smart.WebUserControls
char[] delimiter = delimStr.ToCharArray();
string[] finalUrl = MyUrl.LocalPath.ToString().Split(delimiter);
int n = finalUrl.Length;
answ=finalUrl[n - 1].ToString();
answ = finalUrl[n - 1].ToString();
}
catch
{ }
return answ;
}
}
#endif
}
}