0

I'd like to set a cookie with jquery and access it in server side code.

this is what I came up with so far:

in jquery:

$.cookie("MyKey", "MyData", { path: "/" })

in vb.net (serverside code):

If Request.Cookies("MyKey") IsNot Nothing Then
       Dim mystring As String = Request.Cookies.Get("MyKey").Value
End if

but I it returns nothing. Is there a way to fix this?

Thanks in advance

Sara Nikta Yousefi
  • 1,467
  • 5
  • 21
  • 35
  • What does debugging return? When/where are you setting the cookie? When do you try to get the value? In Page_Load? – Mahendran Nadesan May 23 '16 at 21:18
  • tnx for answering...in the debugging I see the cookie has the value of nothing but when I check this cookie with jquery it does have "MyData" value....In the page load of the page with jquery...in the page_loadComplete in code behind – Sara Nikta Yousefi May 24 '16 at 03:48

0 Answers0