javascript - How do I read a cookie created in jquery from code behind in vb.net? -
i have created cookie in javascript...
(document).ready(function () { $.cookie("test", "hello michael"); alert($.cookie("test")); });
the alert displays cookie content expected. , trying read in vb.net code behind...
dim cookie httpcookie cookie = httpcontext.current.request.cookies.get("test") if isnothing(cookie) txtcookie.text = "cookie not found" else txtcookie.text = cookie.value end if
i 'cookie not found".
i missing something... please advise!
you need add path
value cookie,
$.cookie("test", "hello michael", { path : "/" });
and, request.cookies("test")
work. also, (document)
, $
missing.
Comments
Post a Comment