2

大家好,我有这个问题,即lastGuestInsertedId从文件后面的代码中的 C# cookie 到另一个 Web 表单,该表单lastGuestInsertedId通过 jquery 检索值,然后通过警报显示值。有任何想法吗?

C# 代码

            HttpCookie GuestCookie = new HttpCookie("GuestCookie");
            GuestCookie["Key"] = Convert.ToString(lastGuestInsertedId) ;

            GuestCookie.Expires = DateTime.Now.AddDays(1d);
            Response.Cookies.Add(GuestCookie);

jQuery 代码

            var guestkey = $.cookie("GuestCookie")
            alert(guestkey);
4

1 回答 1

2

$.cookie is not part of default jQuery. You need some jQuery plugin to do that.

To check if you actually have cookies on client side - alert(document.cookie).

于 2012-05-17T04:56:27.807 回答