How to access Session variable in HTML Page

on Oct 10, 2021 01:33 PM


Please let me know how to access Session variable value in HTML Page?


Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Oct 10, 2021 01:37 PM


I am not sure what you are using?

Is it ASP.Net WebForms or MVC?

Anyways here is the solution.

Let's say you have a Session variable

Session["Name"] = "Mudassar";

Then you can display in HTML in following way

ASP.Net WebForms (ASPX Page)


ASP.Net MVC (View)



But if you want to access from plain HTML, then you need to do an AJAX call and access Session from Server