Initial commit
This commit is contained in:
41
Administration/Downloader.aspx.cs
Normal file
41
Administration/Downloader.aspx.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace QW2021C.Administration
|
||||
{
|
||||
public partial class Downloader : System.Web.UI.Page
|
||||
{
|
||||
Helper.Log log = new Helper.Log();
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Session["LoggedIn"].ToString() == "False")
|
||||
{
|
||||
Response.Redirect("~/default.aspx");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
Response.Redirect("~/default.aspx");
|
||||
return;
|
||||
|
||||
}
|
||||
string fn = Request.QueryString["fn"];
|
||||
string filename = Request.QueryString["fn"];
|
||||
string targetFolder = HttpContext.Current.Server.MapPath("~/Downloads");
|
||||
log.insert_entry(2, Convert.ToInt32(Session["UserID"]), "Download " + fn);
|
||||
|
||||
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
||||
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fn);
|
||||
Response.TransmitFile(targetFolder + "\\" + fn);
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user