ASP.NET_SessionId cookie is undefined

asp.net-mvc, c#, session-cookies

Solution

You cannot access the session cookie because it is set to HTTP Only.

so it is hidden from JavaScript for security reasons. It would be a massive security flaw to expose it to JavaScript.

This coding horror blog talks about how cookies are protected from Javascript

Problem

I am working on ASP.NET MVC application. I want to access sessionid in javascript, so for this i was trying to read an ASP.NET_SessionId cookie in javascript: ``` => $.cookie("ASP.NET_SessionId") => undefined ``` but i am getting undefined. Can anybody tell me how can i access the sessionId cookie ?

Original source