title: signalR connection breaks after redirection to another view in MVC3 app
body: <p>I am trying to implement SignalR in my existing MVC3 application to send alerts to all connected client. I am using Persistent connection. Just to test this i have placed a broadcast button on _Layout page. Clicking on broadcast button sends some text using connection.send($(‘#msg’).val()); and is successfully received by the clients. But this only works when the message is broadcasted from first/default page when app loads. Once the page is redirected it looses the connection and on click of Broadcast button it throws error message “SignalR: Connection must be started before data can be sent. Call .start() before .send()”. Please advice.
  Here's the code in my sample application: Note that when i navigate from Home to About, the connection gets lost.</p>
  
  <pre><code>&lt;head&gt;
  &lt;title&gt;@ViewBag.Title&lt;/title&gt;
  &lt;link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/Scripts/jquery.signalR.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script src="@Url.Content("~/signalr/hubs")" type="text/javascript"&gt;&lt;/script&gt;
  
  &lt;script type="text/javascript"&gt;
  $(function () {
      var connection = $.connection('echo');
  
      connection.received(function (data) {
          alert(data);
      });
  
      connection.start();
  
      $("#broadcast").click(function () {
          connection.send($('#msg').val());
      });
  });
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;input type="text" id="msg" /&gt;         
  &lt;input type="button" id="broadcast" value="Broadcast" /&gt;
  &lt;ul id="messages"&gt;&lt;/ul&gt; 
  &lt;div class="page"&gt;
  
      &lt;div id="header"&gt;
          &lt;div id="title"&gt;
              &lt;h1&gt;My MVC Application&lt;/h1&gt;
          &lt;/div&gt;
  
          &lt;div id="logindisplay"&gt;
              @Html.Partial("_LogOnPartial")
          &lt;/div&gt;
  
          &lt;div id="menucontainer"&gt;
  
              &lt;ul id="menu"&gt;
                  &lt;li&gt;@Html.ActionLink("Home", "Index", "Home")&lt;/li&gt;
                  &lt;li&gt;@Html.ActionLink("About", "About", "Home")&lt;/li&gt;
              &lt;/ul&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div id="main"&gt;
          @RenderBody()
          &lt;div id="footer"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>