title: signalR use/persistance after a POST
body: <p>Currently having a look at the use of signalR to present users with a progress report of a file while it is processing. I'm using asp.net MVC 4. When doing a post/get via Ajax I have no trouble getting the status changes. </p>
  
  <p>Since I need to upload a file (without ajax, since 1: I cannot require users to have js enabled in order to submit the file; 2: I don't believe it's readily available to do such a task, apart from maybe HTML5).</p>
  
  <p><strong>EDIT:</strong>
  When I say I cannot require users to have JS, I mean submitting the file cannot rely on JS because that is a core functionality. However, I would like those who have JS enabled to see the progress of the processing/import into another program. I am not currently interested/caring about the actual file transfer progress, but more so sending status messages back to the current state of an import into the program.</p>
  
  <p>What approach would be suggested in order to achieve the goal of updating progress as the file processes after I have called the form Post?
  Note: </p>
  
  <p>Example Code: </p>
  
  <pre><code>$(function () {
      var fileUploadHub = $.connection.fileUploadHub;
  
      fileUploadHub.updateProgress = function (value) {
          updateProgressBar(value);
      };
  
      fileUploadHub.updateStatusText = function (text) {
          alert("you got to updateStatus");
          updateText(text);
      };
      $.connection.hub.logging = true;
      $.connection.hub.start();
  });
  
  function updateProgressBar(value) {
      $("#progressbar").progressbar({ value: value });
  }
  
  function updateText(text) {
      $("#statusText").append("&lt;li&gt;" + text + "&lt;/li&gt;");
  }
  </code></pre>
  
  <p>//Form : Backed by a Model</p>
  
  <pre><code>@using (Html.BeginForm( "UploadFile", "FileUpload", FormMethod.Post,
      new { enctype = "multipart/form-data"}))
  {
      &lt;input type="file" id="Files" name="Files" accept="text/xml" /&gt;
      &lt;br /&gt;
      &lt;input type="submit" id="submitButton" value="Submit" /&gt;
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public ActionResult SubmitFile(MyModel model)
  {
    ...
    ProcessFile(model.file)
    ...
  }
  
  public void ProcessFile(File file)
  {
    var myHub = GlobalHost.ConnectionManager.GetHubContext&lt;FileUploadHub&gt;();
    myHub.Clients.updateStatusText("testz");
  }
  </code></pre>
  
  <p>Hub Class:</p>
  
  <pre><code>public class FileUploadHub : Hub
  {
  }
  </code></pre>