一千萬個為什麽

搜索

什麽時候有cookie?

嗨,我有一個Web應用程序,我在我的頁面上種植一個cookie。然後用戶轉到另一個頁面,然後從該頁面調用腳本中的頁面,如下所示:

<script type="text/javascript" src="http://domain.com/page.aspx?id=6" ></script>

但是當我調用我的頁面時我無法訪問cookie,為什麽不呢?以及如何解決它?

Please note that this question is in relation to: Javascript and webshop tracking/affiliate across websites, how to do?

Edit The "other" page is on a entirely different domain. My code is in ASP.NET, but as far as i know its the same for all languages:

種植cookie(Default.aspx):

protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cookies["affiliate"].Value = "InnovationPartner";
        Response.Cookies["affiliate"].Expires = DateTime.Now.AddDays(7);
        ...
    }

檢索cookie(往返後)(Collect.aspx):

protected void Page_Load(object sender, EventArgs e)
    {
        bool affiliate = Request.Cookies["affiliate"] != null ? true : false;
        ...
    }

最佳答案

從不同的域名調用時,必須實施 P3P 簽名。
無論如何,您必須始終觀察HTTP日誌以跟蹤cookie流

轉載註明原文: 什麽時候有cookie?