36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using CMS_SC_Data;
|
|
using SteamWare;
|
|
using System;
|
|
|
|
namespace CMS_SC
|
|
{
|
|
public partial class downloadReport : System.Web.UI.Page
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
// recupero da querystring nome file (path temp + nome file...)
|
|
string baseDir = memLayer.ML.QSS("baseDir");
|
|
string fileName = memLayer.ML.QSS("fileName");
|
|
string cType = memLayer.ML.QSS("cType");
|
|
string file2download = Server.MapPath($"{baseDir}\\{fileName}");
|
|
logger.lg.scriviLog($"Richiesto download report dall'utente {OpAuth.currAuth.CognomeNome} ({OpAuth.currAuth.email}) | {file2download} --> {fileName} ({cType})");
|
|
// check sicurezza: proseguo SOLO SE ho valori E parto dalla cartella tmp...
|
|
if (!string.IsNullOrEmpty(baseDir))
|
|
{
|
|
if (!string.IsNullOrEmpty(fileName))
|
|
{
|
|
if (!string.IsNullOrEmpty(cType))
|
|
{
|
|
if (baseDir.Contains("tmp"))
|
|
{
|
|
Response.ContentType = $"application/{cType}";
|
|
Response.AddHeader("Content-Disposition", $"attachment; filename={fileName}");
|
|
Response.TransmitFile(file2download);
|
|
Response.End();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |