我使用asp.net C#代碼做了廚師做,我想在javascript來檢索其值閱讀在JavaScript的cookie,通過asp.net C#代碼
這裏是我的C#代碼:
HttpCookie cookie = new HttpCookie("doc1count");
cookie.Value = "hellonitesh";
我用這代碼:
var cookie = '@HttpContext.Current.Request.Cookies["doc1count"].Value';
alert(cookie);
但它給我垃圾值。
這也適用於asmx web服務 –