Get session variables from Session Provider class in javascript <p>Hi I have a Session Provider class to handle Sessions in my MVC application.</p> <p>Here is the Session Provider Class...</p> <pre><code>public class SessionProvider { public static Portal.Application.BoundedContext.ScreenPop.Dtos.User LoggedUser { get { return (Portal.Application.BoundedContext.ScreenPop.Dtos.User) HttpContext.Current.Session["LoggedUser"]; } set { HttpContext.Current.Session["LoggedUser"] = value; } } public static void Clear() { HttpContext.Current.Session.Abandon(); HttpContext.Current.Session.Clear(); } } </code></pre> <p>And the User class which used to cast the above Session has these attributes.</p> <ul> <li>Name </li> <li>PhoneNumber</li> </ul> <p>I need to get these Name and Phone number in my View using javascript..</p> <p>Here what I have dobe so far...</p> <pre><code>&lt;script type="text/javascript"&gt; @{ User loggedUser = SessionProvider.LoggedUser; } var loggedUserName = loggedUser.Name ; var loggedUserPhone = loggedUser.PhoneNumber; &lt;/Script&gt; </code></pre> <p>But I have this error in firebug when I run my application..</p> <pre><code>ReferenceError: loggedUser is not defined var loggedUserName = loggedUser.Name; </code></pre> <p>How can I get those two values? I am using Razor View engine...</p>