How do you access JavaScript cookies from ASP?
The way the script works is that if there is no cookie named "droppedin" then it sets one and displays the disclaimer as an animated/fly-in window.
I want the logout page (logout.asp) to clear this cookie. I have tried the following:
Response.Buffer = true
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
Server.ScriptTimeout = 60
Session("uid") = ""
Session("pass") = ""
Session("group") = ""
Session("shift") = ""
Session("UserAuth") = ""
Session("UserAdmin") = ""
Response.Cookies("droppedin") = ""
Response.Redirect("login.asp")
This does not clear the cookie. Using TamperData in Firefox, the cookie values show as follows (note 2 droppedin cookies):
Cookie=droppedin=yes; droppedin=; ASPSESSIONIDCCACSRDS=GDNPECNDBANFJKFAAOLOMMDI
How can I access a cookie set by JavaScript and re-set it from ASP/VBScript?
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$3 Answers
response.cookies("droppedin").expires=now
this essentially 'destroys' the cookie.
You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$You can leave an optional "tip" with Mahalo's virtual currency, Mahalo Dollars. If you are asking a difficult question that might require some research, or if you'd like a wide variety of feedback, a higher tip often leads to more answers to your question.
M$This introduces a possible workaround, by passing the Javascript and ASP calls back and forth through page requests. Not the best solution, but the best so far. If Mahalo didn't give the other response Best Answer already, I'd give it to you as the other response suffers the same issue I've been having
The issue is it's not overriding the initial cookie. It's creating a separate cookie with the same name. The Javascript sets it's own cookie and the ASP code sets another one. I want them to overwrite/share the cookie, or be able to change the variable.
That would expire the "ASP" cookie, but not the JavaScript cookie.