今天遇到一個很邪門的事情,以自己的技術積累無法解釋
asp .net 執行下列代碼,存入cookie
public static void WriteCookie(string strName, string key, string strValue, int expires) { HttpCookie cookie = HttpContext.Current.Request.Cookies[strName]; if (cookie == null) { cookie = new HttpCookie(strName); } cookie[key] = UrlEncode(strValue); cookie.Expires = DateTime.Now.AddMinutes(expires); HttpContext.Current.Response.AppendCookie(cookie); } Utils.WriteCookie(dicName, "YHErpPage", Utils.UrlDecode(strJson), 525600);
執行下列代碼跳轉鏈接
ClientScript.RegisterStartupScript(Page.GetType(), "", "<script language=javascript> window.parent.location.reload();</script>");
跳轉鏈接之后發現cookie丟失
有遇到過此情況的大神請指點一二。
線索1cookie可能未成功存入。線索2 未改動代碼,換一個瀏覽器 一切正常。