title: asp.NET controller does not seem to be executing in proper order
body: <p>I am using the jQuery File Upload Plugin and posting zip files to my controller. But something is happening with the execution order that I cannot seem to figure out. When I set the debug point at the top it seems to jump all over the place in my controller and because of this, my code does not seem to be working as I would think it should. </p>
  
  <p>Here is my POST: </p>
  
  <pre><code>$('#fileupload').fileupload({
      url: '/FileUpload/Import',
      add: function (e, data) {
          var fileSubmit = data.submit()
              .success(function (result, textStatus, fileSubmit) {
                  var name = data.files[0].name;
                  fileValidation(name, textStatus);
  
              })
              .error(function (fileSubmit, textStatus, errorThrown) {
                  var name = data.files[0].name;
                  fileValidation(name, textStatus);
              });           
      },
      done: function (e, data) {
          $.each(data.files, function(index, value){
              if (value.name == "") {
                  alert("Error uploading: " + value.name + ". " + failStatus);
              }
              else 
              {
                  $('#fileSubmit').show();
              }
          });
      }
  });
  </code></pre>
  
  <p>Which seems to be firing off like i think it would. It will POST one file at a time as shown here with Fiddler:</p>
  
  <p><img src="https://i.stack.imgur.com/WUnUK.png" alt="enter image description here"></p>
  
  <p>asp.NET controller does not seem to be executing in proper order and instead bounces all over the place. Here is my controller:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Import()
  {
      List&lt;ZipContents&gt; fileList = new List&lt;ZipContents&gt;();
      var r = "File successfully uploaded.";
  
      try
      {         
          if (Session["SESSION_IMPORT_STORAGE"] != null)
          {
  
              fileList = (List&lt;ZipContents&gt;)Session["SESSION_IMPORT_STORAGE"];
          }
  
          Stream s = Request.Files[0].InputStream;
          String fn = Request.Files[0].FileName;
          fileList.Add(new ZipContents(s, fn));
  
          Session["SESSION_IMPORT_STORAGE"] = fileList;
  
      }
      catch
      {
          r = "An error occurred uploading file(s).";
      }
  
      return Json(r);
  }
  </code></pre>
  
  <p>What I mean by this is that if I set a debug point at: </p>
  
  <pre><code>List&lt;ZipContents&gt; fileList = new List&lt;ZipContents&gt;();
  </code></pre>
  
  <p>And then hover over: <code>String fn = Request.Files[0].FileName;</code> it says: <code>"moreXmlFiles.zip"</code></p>
  
  <p>Then I hit F11 and it moves to the next line. And again steps into the <code>try</code>. and again hits the <code>if statement</code>.</p>
  
  <p>If I hit F11 again it goes all the way to my original debug point and when I hover over <code>String fn = Request.Files[0].FileName;</code> again it shows the next file name already. But my code didn't even finish  with the first file...</p>
  
  <p>Does anyone know what is going on here?! Any help would be much appreciated. Thanks!</p>