Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // add a check to see that the user has access to this object
          //Response.WriteFile("C:\\.rnd");

          if (Request["redir"] != null)
          {
               using (WeavverEntityContainer dataContext = new WeavverEntityContainer())
               {
                    IT_DownloadLogs downloadLog = new IT_DownloadLogs();
                    downloadLog.Id = Guid.NewGuid();
                    downloadLog.OrganizationId = SelectedOrganization.Id;
                    downloadLog.FileName = System.IO.Path.GetFileName(Request["redir"]);
                    downloadLog.DownloadedAt = DateTime.UtcNow;
                    downloadLog.DownloadedByIP = Request.UserHostAddress;
                    downloadLog.DownloadedBy = LoggedInUser.Id;

                    dataContext.AddToIT_DownloadLogs(downloadLog);
                    dataContext.SaveChanges();

                    Response.Redirect(Request["redir"]);
               }
          }
    }