I am working on cookies in asp and I need an option to delete the cookie when a button is clicked. So i just write an empty string in it.
I set the cookies as:
Response.Cookies("name")="Henry"
The code for button is:
<INPUT type="button" value="Remove" OnClick="removeCookie">
The code for deleting the value is:
<SCRIPT language="VBSCRIPT">
Sub RemoveCookie
document.cookie = "name="
End Sub
</SCRIPT>
However I realise that this creates a duplicate cookie named name without any value( Checked it by retrieving all cookies).I guess one copy is created at the client and other at the server which gives me erroneous results when i access the value of the cookie later.
I can reset the value of the cookie uisng Response.Cookies but i do not know how to implement it on a button click.
Any proposed solns shall be appreciated.
thanks