I am saving some cookie values on an ASP page. I want to set the root path for cookie so that the cookie will be available on all pages.
Currently the cookie path is /v/abcfile/frontend/
Please help me.
cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; This statement will delete a cookie named “username” if one exists. Some browsers will not allow the deletion of a cookie if the path is not specified. Therefore, it is important to always specify the path when working with cookies.
You can't access cookies from a different path - otherwise it would be a security hole.
For those who didn't know, cookies are only accessible to the specified path and any subpaths, no superpaths. So cookies for the path "/folder/subfolder1/" are not accessible to "/folder/".
simply: document.cookie="name=value;path=/";
There is a negative point to it
Now, the cookie will be available to all directories on the domain it is set from. If the website is just one of many at that domain, it’s best not to do this because everyone else will also have access to your cookie information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With