Asp .net Forms Authentication token using pure javascript
How can I do something like开发者_运维问答 this:
Request.Cookies[FormsAuthentication.FormsCookieName].Value
in javascript?
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).
精彩评论