46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace CMS_SC
|
|
{
|
|
/// <summary>
|
|
/// Descrizione di riepilogo per windowSize
|
|
/// vedere https://techbrij.com/browser-height-width-server-responsive-design-asp-net
|
|
/// </summary>
|
|
public class windowSize : IHttpHandler, System.Web.SessionState.IRequiresSessionState
|
|
{
|
|
/// <summary>
|
|
/// Processa la richeista andando a recuperare width-height del browser
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
context.Response.ContentType = "application/json";
|
|
|
|
var json = new System.Web.Script.Serialization.JavaScriptSerializer();
|
|
var output = json.Serialize(new { isFirst = context.Session["BrowserWidth"] == null });
|
|
context.Response.Write(output);
|
|
|
|
context.Session["BrowserWidth"] = context.Request.QueryString["Width"];
|
|
context.Session["BrowserHeight"] = context.Request.QueryString["Height"];
|
|
// salva in REDIS come conteggio INCREMENTALE...
|
|
if (memLayer.ML.CRB("SC_RedEnab"))
|
|
{
|
|
string memName = string.Format("COUNT:wh:{0}x{1}", context.Request.QueryString["Width"], context.Request.QueryString["Height"]);
|
|
// conto +1 x la size nel contatore REDIS
|
|
long nCall = memLayer.ML.setRCntI(memLayer.ML.redHash(memName));
|
|
}
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
} |