Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not getting session value in angularjs file

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) 
like image 205
Chiragkumar Thakar Avatar asked Mar 02 '26 13:03

Chiragkumar Thakar


1 Answers

ASP.NET is backend and Angular runs in the browser. ;-)

You have several options:

  1. write the session into a cookie (if not already done by ASP.NET) and read the value via the angular-cookies library

  2. write a RESTful service to get some session information value

  3. render the value into a hidden field and read it via jquery

like image 188
Michael Avatar answered Mar 05 '26 01:03

Michael