title: How to save text values from web page locally and is it possible to have web page front end, C# back end?
body: <p>I am creating a web page that will have many text input boxes structured like the below example.</p>
  
  <pre><code>&lt;input type="text" id="textID" name="textName" placeholder="Enter your text here"&gt;
  </code></pre>
  
  <p>I will have a button at the bottom of the page that I want to grab all the values from each text box, preferably if possible Serialize into XML format and then save locally. If Serializing is not possible, saving to a txt/doc/etc will work. I am using javascript to do that work. </p>
  
  <p>I have figured out how to have my button when clicked save a document of my choosing locally, but I have to use a web url to pull from and this only saves the page source code. That does me no good. I cannot figure out what to put in place of the below save.href. The save.href is forcing the use of the URL which I do not want. </p>
  
  <pre><code>&lt;HTML&gt;
  //web page stuff
  
  //Many of these inputs like this one below
  &lt;input type="text" id="textID" name="textName" placeholder="Enter your text here"&gt;
  
  &lt;script language="javascript" type="text/javascript"&gt;
  
  function SaveData() 
  {
    var fileURL = "http://localhost:51088/index.html";
    var fileName = "test.txt";
  
  
    if (!window.ActiveXObject) 
    {
      var save = document.createElement('a');
      save.href = fileURL;
      save.target = '_blank';
      save.download = fileName || 'unknown';
  
      var event = document.createEvent('Event');
      event.initEvent('click', true, true);
      save.dispatchEvent(event);
      (window.URL || window.webkitURL).revokeObjectURL(save.href);
    }
  
      // for IE
    else if (!!window.ActiveXObject &amp;&amp; document.execCommand) 
    {
      var _window = window.open(fileURL, '_blank');
      _window.document.close();
      _window.document.execCommand('SaveAs', true, fileName || fileURL)
      _window.close();
   }
  }
  &lt;/script&gt;
  &lt;/HTML&gt;
  </code></pre>
  
  <p>This code above is producing a text file that downloads locally to my box but it is only of the page source code for the URL I provided. How can I grab all the values from the text boxes and save that data locally?</p>
  
  <p>I know I can do something like this example below to grab the text box values but how can I then take this value and save it?</p>
  
  <pre><code>var textBoxValue = document.getElementById("textID").value;
  </code></pre>
  
  <p>And an additional path I ultimately would like to take is to somehow write a C# business layer code that can bind directly to the text boxes on the web page. If not bind, at least pass the values to the C# code. If I can achieve that then I can handle formatting, saving, etc within C#. Is it possible to have an HTML web page, with JavaScript as the UI and C# as the back end? </p>