title: save uploaded files to a session user asp.net
body: <p>i have an e commerce site and i have implemented an upload function where users can upload jpeg files, and after, they are able to see it in the grid view immediately. here is the code:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
      {
          if (Session["New"] != null)
          {
              if (!IsPostBack)
              {
  
                  Label2.Text += Session["New"].ToString();
                  linkLogout.Visible = true;
                  //linkOrderHistory.Visible = true;
                  Label2.Visible = true;
                  linkViewProfile.Visible = true;
                  string[] filePaths = Directory.GetFiles(Server.MapPath("~/Uploads/"));
                  List&lt;ListItem&gt; files = new List&lt;ListItem&gt;();
                  foreach (string filePath in filePaths)
                  {
                      files.Add(new ListItem(Path.GetFileName(filePath), filePath));
                  }
                  GridView1.DataSource = files;
                  GridView1.DataBind();
  
              }
          }
  
      }
      protected void UploadFile(object sender, EventArgs e)
      {
          string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
          FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Uploads/") + fileName);
          Response.Redirect(Request.Url.AbsoluteUri);
      }
      protected void DownloadFile(object sender, EventArgs e)
      {
          string filePath = (sender as LinkButton).CommandArgument;
          Response.ContentType = ContentType;
          Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath));
          Response.WriteFile(filePath);
          Response.End();
      }
  </code></pre>
  
  <p>what i want to happen is to for example user A has logged in and uploaded a file, it will be only for that user. 
  <a href="https://i.stack.imgur.com/j5AJA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j5AJA.jpg" alt="enter image description here"></a></p>
  
  <p>do i have to put this on a database? any tricks guys? thank you in advance.</p>