title: Sharing sessions across applications using the ASP.NET Session State Service
body: <p>I am trying to share sessions between two web applications, both hosted on the same server. One is a .net 2.0 web forms application the other is as .net 3.5 MVC2 application.</p>
  
  <p>Both apps have their session set up like this: </p>
  
  <pre><code>&lt;sessionState
        mode="StateServer"
        stateConnectionString="tcpip=127.0.0.1:42424"
        /&gt;
  </code></pre>
  
  <p>In the webform application I am posting the the session key to the MVC app:</p>
  
  <pre><code>protected void LinkButton1_Click(object sender, EventArgs e)
  {
      Session["myvariable"] = "dan"; 
      string sessionKey = HttpContext.Current.Session.SessionID;
  
      //Followed by some code that posts sessionKey to the other application    
  }
  </code></pre>
  
  <p>I then recieve it in the MVC application and try use the same session like this:</p>
  
  <pre><code>[HttpPost]
  public  void Recieve(string sessionKey )
  {
      var manager = new SessionIDManager();
  
      bool redirected;
      bool IsAdded;
  
       manager.SaveSessionID(HttpContext.ApplicationInstance.Context, Id, out redirected, out IsAdded);
       var myVar = Session["myvariable"];
  
  }
  </code></pre>
  
  <p>The key is being posted but the session does not seem to get loaded in the MVC app, i.e. sessionKey is null. Can what I am trying to do be done?</p>