using BeWo.Data; using BeWo.Service.Security; using BS.Shared.Core; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Host { public partial class DownloadFile : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { try { if (!SessionFacade.IsUserLoggedIn()) { throw new SecurityException("Invalid authentication"); } var key = this.Request.Params["key"]; if (key != "jhkf4589141324h6543958") { throw new SecurityException("Invalid authentication"); } string lPath = @"C:\BeWoPlaner\Test\test.pdf"; Response.AddHeader("content-disposition", "attachment;filename=test.pdf"); Response.Charset = string.Empty; Response.ContentType = "application/.pdf"; Response.TransmitFile(lPath); } catch (Exception ex) { Response.Write(ex.ToString()); } Response.End(); } } }