how to identify a cookie is from client-side or server-side?

孤街醉人 提交于 2020-01-05 09:05:27

问题


how does the browser differentiate a cookie is from client-side created (JavaScript) or server-side created (ASP.NET). Is it possible to delete cookie created from server side in client side and vice versa, I'm struggling to delete a cookie was created from client-side using javascript in ASP.NET code-behind.


回答1:


how does the browser differentiate a cookie is from Client side(javascript created) or serverside created (Asp.net).

It doesn't. A cookie is a cookie.

The closest it comes is the HTTP Only flag, which allows a cookie to be hidden from JavaScript. (This provides a little defence against XSS cookie theft).

it is possible to delete cookie created from server side in client side and vice versa

Yes. A cookie is a cookie. (Again, client side code can't touch an HTTP only cookie)




回答2:


As far as I know it is possible if there is not property HttpOnly owasp wikipedia.

In chrome, for the cookies, there is a field - Accessible by script, which indicates if HttpOnly is set.



来源:https://stackoverflow.com/questions/10100940/how-to-identify-a-cookie-is-from-client-side-or-server-side

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!