Jump to content

ASP Cookies


Lee-yoshi

Recommended Posts

Hi,This might sound like a stupid question (I'm new to ASP) but is it possible to add to an ASP Cookie through a link? (I.e. Someone clicks on a link, and by clicking that link something is added to the cookie)And if so, how?Many thanks.

Link to comment
Share on other sites

You can either use Javascript to set a cookie or ASP. If you wanted to use ASP then the page would need to refresh. If you used Javascript you could change the cookie without refreshing the page.

Link to comment
Share on other sites

Thanks justsomeguy, really appreciate the help.I attempted Javascript but i need some ASP related elements within my cookies so i've gone back to ASP again.Is it possible to have a variable property as a name for a cookie? My problem is that i need cookies to hold different numbers, numbers of which i will not know, and of which there may be more than one of (Hence storing another number in another cookie so it is easy to retrieve). The code below works great the first time, the second time there is a problem though, and it's most likely from the line where (NumItems) doesn't have " around it because it's the name of a variable.

<%dim NumItemsdim POIDPOID = request.querystring("poid")if( Response.Cookies.Count > 0 ) Then	NumItems = Request.Cookies("Amount")	NumItems = NumItems + 1	Response.Cookies("Amount") = NumItems	Response.Cookies(NumItems)("Item") = POIDelse	Response.Cookies("Amount") = 1End if%>...

Thanks for any help you can give me.

Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...