title: how to get Session in javascript from ASP.NET MVC
body: <p>I have some belows , please help me how i can get Session in Javascript code from Controller ? </p>
  
  <pre><code>public ActionResult Login(FormCollection f)
      {
          string sAcount = f["txtAccount"].ToString();
          string sPassword = f.Get("txtPassword").ToString();
  
          tblCustom cs = db.tblCustoms.SingleOrDefault(n=&gt;n.Account==sAccount &amp;&amp; n.Password==sPassword);
  
          if (cs != null)
          {
  
              Session["Account"] = cs;
  
              return View();
  
          }
  
          return View();
  
      }
  </code></pre>
  
  <p>and JS code is </p>
  
  <pre><code>        &lt;script &gt; 
  
         $('#btnSendMsg').click(function () {
  
                    var msg = $("#txtMessage").val();
  
                    alert('Hello' + Session["Account"] );
                   });   
  
      &lt;script/&gt;
  </code></pre>
  
  <p>the result is alert stil is not working, help me.</p>