I want to access asp.net(C#) session value in angularjs file, what should be the best way to access session value.
What i tried, but couldn't able to get it.
$session.get(key)
ASP.NET is backend and Angular runs in the browser. ;-)
You have several options:
write the session into a cookie (if not already done by ASP.NET) and read the value via the angular-cookies library
write a RESTful service to get some session information value
render the value into a hidden field and read it via jquery
$cookies.get(key) or $cookies.getObject(key), that depends on what information you wanna put into the cookie. Personally I'd use a web service and get the information with a GET request and JSON formatYou need to do this through a server side controller, the session is stored on the server, while angular will run on the client. So you can make a Session controller to receive a key and to return in JSOn format the value from the Session.
Expanding on Michael's 2nd option "write a RESTful service to get some session information value"
One possible way to do this is