Reputation: 84
every one know session value are stored in server and asp.net generate key for every session variable that is stored in cookies.This raised two questions in my mind 1. where exactly session variable stored in server.I mean in which file and where is it located in server ? 2. is there any way to get session value from cookies ?
Upvotes: 0
Views: 471
Reputation: 1038710
1) where exactly session variable stored in server.
That depends on where you told it to. By default it goes in the memory of your webserver. But you could configure it also to be stored out-of-process or even in SQL server. Take a look at the session state modes
. For example if you are running in a webfarm, you definitely don't want your session to be stored in-memory because the nodes of your webfarm won't be able to share this information between them.
2) is there any way to get session value from cookies ?
No, absolutely no. That would completely defeat the whole security of the session (which as you correctly stated is only stored on the server). The cookie value is just a pointer to this information. If you wanted to retrieve some session value from the client side you will have to write an endpoint and explicitly expose it.
Upvotes: 1