title: How to save an embedded PDF to a folder inside solution in ASP.net web app
body: <p>I am writing a web app in asp.net using the bootstrap framework for style. The purpose is to have a pdf displayed, then the user fills out the pdf and it should get saved to a folder inside the solution for further processing after clicking the button below. I was able to embed the pdf and have it be fully editable, however, I am stuck trying to save it back to the solution. I have researched the web for answers, but the only thing that I think might be useful is the File.writeAllBytes() method. I just can't figure out how to implement it. Any help or suggestions on how to accomplish this is greatly appreciated.</p>
  
  <p>Heres the UI code:</p>
  
  <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" masterpagefile="~/Site.Master" 
  CodeBehind="RenderPDF.aspx.cs" Inherits="DocusignTest.RenderPDF" %&gt;
  
  &lt;asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-lg-4"&gt;
          &lt;div class="jumbotron"&gt;
              &lt;label&gt;First Name:&lt;/label&gt;
              &lt;input type="text" class="form-control"/&gt;
              &lt;label&gt;Last Name:&lt;/label&gt;
              &lt;input type="text" class="form-control"/&gt;
              &lt;label&gt;Email:&lt;/label&gt;
              &lt;input type="email" class="form-control"/&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-lg-8"&gt;
          &lt;!-- this is the pdf the user needs to fill out --&gt;
          &lt;embed id="pdf" src="e-docs/PAF.pdf" style="width: 100%; height:1000px"/&gt;
          &lt;div class="pager"&gt;
              &lt;asp:Button ID="eSignButton" runat="server" CssClass="btn btn-primary" Text="Sign" OnClick="eSign_Click" Enabled="false"/&gt;
              &lt;input type="checkbox" id="eSignCheckbox" onclick="enableButton();"/&gt;I have filled out this document to the best of my abilities.
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script lang="javascript" type="text/javascript"&gt;
      var button = WebForm_GetElementById("MainContent_eSignButton")
      var checkbox = WebForm_GetElementById("eSignCheckbox")
      function enableButton() {
          if (checkbox.checked) {
              button.disabled = false;
          } else {
              button.disabled = true;
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is the code-behind:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.IO;
  
  namespace DocusignTest
  {
      public partial class RenderPDF : System.Web.UI.Page
      {
  
      protected void Page_Load(object sender, EventArgs e)
      {
  
      }
  
      protected void eSign_Click(object sender, EventArgs e)
      {
          savePDF();
      }
  
      protected void savePDF()
      {
          //DO something. 
          //Maybe using File.writeAllBytes() to save the embedded PDF to folder in solution.
      }
  }
  </code></pre>