I wanted to access a session variable in javascript in asp.net mvc application. I have found a way to do it in aspx view engine but not in razor.
Please tell me a wa
For google searchers,
In addition, If you want to access the session variable in external .js file you can simply do like this,
.js
------ SOME HTML PAGE ------ //Scripts below Html page // Load External Javascript file
Inside NewFile.js
NewFile.js
$(document).ready(function () { alert(mySessionVariable); });