我有这个:
// connect to MemberHub
function connect() {
// get unique id cookie
var uid = $.cookie('UniqueID', { path: '/' });
member.server.connect(uid).done(function (result) {
if (result.msg == 'success') {
// notify user
$('#log').append($('<li>', { html: 'Connected to MemberHUB' }));
}
});
}
每次我尝试读取 cookie 时,它都会创建相同的 cookie 而不是读取它。
更新:这是我分配 cookie 的方式:
public static HttpCookie Create(string name, string value,
DateTime expires, HttpContextBase httpContext)
{
var cookie = new HttpCookie(name)
{
Value = value,
Expires = expires,
Secure = true,
HttpOnly = false,
Path = "/"
};
httpContext.Response.Cookies.Add(cookie);
return cookie;
}
任何建议都会有所帮助。