Introduction: Asp.Net Get Session Values in JavaScript

In this post, we will learn about getting ASP.NET session value in javascript.


In my previous posts I have explained various topics like Introduction To JSON, Ajax Control in ASP.NET, AJAX Basics, Optional Arguments In C#, difference between Stack and Heap memory in C#, Difference Between Class And Structure, ASP.NET Core, C# static constructor.

Now in this post, I will explain about Asp.Net Get Session Values in JavaScript.

By making use of “Session” property we can easily access session variable value in JavaScript or jQuery.

Now create  Web form application in Visual Studio and write below lines of code in it.

<html xmlns="">
<head runat="server">
    <title>Session Values in JavaScript</title>
   <script type="text/javascript" src=""></script>
<script type="text/javascript">
<form id="frmMain" runat="server">
        <label id="lblEmployeeName" />


Now, Write below lines of code in codebehind file of above .aspx

protected void Page_Load(object sender, EventArgs e)
            Session["EmployeeName"] = "Raj Mehta";


I hope you got an idea about Asp.Net Get Session Values in JavaScript.
I would like to have feedback from my blog readers.
Your valuable feedback, question, or comments about this article are always welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *
Email *