title: Get user input from web form to save to text file
body: <p>I have a web form made that consists of checkboxes, radio buttons and a dateTimePicker.</p>
  
  <p>All of the options work on the form, however I need to somehow get all user input e.g when someone checks 'checkBox1' to save to a text file. Im not sure how to do this in C#.</p>
  
  <p>So far I have -</p>
  
  <pre><code>string path = "path";
  
          try
          {
  
              if (File.Exists(path))
              {
  
                  File.Delete(path);
              }
  
              using (FileStream fs = File.Create(path))
              {
                  Byte[] info = new UTF8Encoding(true).GetBytes("");
                  // Add some information to the file.
                  fs.Write(info, 0, info.Length);
  </code></pre>
  
  <p>I can get the file to write out each specific checkbox name but I want to be able to write out only the checkboxes that have been checked.</p>
  
  <p>I thought it would be something like - <code>if checkbox1.checkedstate = true</code></p>
  
  <p>Any help is greatly appreciated.</p>