跳轉頁面丟失cookie問題


今天遇到一個很邪門的事情,以自己的技術積累無法解釋

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 未改動代碼,換一個瀏覽器 一切正常。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM