How to read and write session values in javascript
Session variables reside on the server and as I'm sure you are aware, Javascript is client-side.
HTTP session vars are controlled by the server, JavaScript runs client side, and as such cannot modify the vars directly. Meaning this isn't possible using only Javascript
Java is client side scripting language. The client's web-browser does not know anything about session!
All you can do is to use cookies to store values which can be accessed across web-pages.
you can't write directly to a server side session var with javascript. Assuming you are not using Ajax here.
Application Seesion is maintain on Sever side and javascript is work on Client side.
so it is not possible to maipulate vlaue of Session variable via javascript
You can use
- HiddenFields
- QueryString
- Cookies
to maintain values on client side
If you speak about server-side session values, there's no other way than to somehow communicate with the server (e.g. with an asynchronous callback where you would read/write them with some method).
For simulation of client-side session variables, you might want to have a look here ;)
You can't because session variables are actually saved to a file on the server only. The only thing your browser knows about the session is the session id, which is saved into a cookie.
This is the whole point with sessions. The variables are safe because no one on the outside can read them. If you want variables readable by the browser, consider using cookies instead.
A bit more context could be useful in understanding what exactly you're trying to achieve. As the session is held on the server, the only way to "instantly" communicate with it would be using AJAX calls.
This being not such a common way of operating maybe explaining your situation may help in giving you alternative, more common ways of doing what you need.