开发者

Asp .net Forms Authentication token using pure javascript

开发者 https://www.devze.com 2023-04-01 04:05 出处:网络
How can I do something like开发者_运维问答 this: Request.Cookies[FormsAuthentication.FormsCookieName].Value

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消