If I run my web app in VisualStudio, and set cookies, they aren’t there if I end the web app and run it again.
Here are my cookie set and get functions:
( Is “userInfo” special or arbitrary? )
' Sets cookie cookie_name to cookie_value.
sub set_cookie( cookie_value , cookie_name )
response.Cookies( "userInfo" )( cookie_name ) = cookie_value
response.Cookies( SOFTWARE_PROGRAM_NAME).Expires = datetime.now.adddays(365*10)
end sub
' Returns cookie named cookie_name.
function get_cookie( byval cookie_name as string )
If Request.Cookies("userInfo") Is Nothing Then
return ""
else
cookie_value = Server.HtmlEncode(Request.Cookies( "userInfo" )( cookie_name ))
return cookie_value
end if
end function
This is because you’re effectively killing the web server. This is going to wipe all variables from memory including cookies.
Try deploying it to IIS.