iLemming
iLemming

Reputation: 36166

Asp .net Forms Authentication token using pure javascript

How can I do something like this:

Request.Cookies[FormsAuthentication.FormsCookieName].Value

in javascript?

Upvotes: 1

Views: 647

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038840

You cannot do something like this in javascript. Authentication cookies are marked with the HttpOnly flag when emitted by ASP.NET meaning that client scripts cannot access them (and of course that's for security reasons). If there was not this HttpOnly flag you could access cookies in javascript using the document.cookie variable but as I said this doesn't apply for authentication cookies (they won't be part of it).

Upvotes: 6

Related Questions