无法在IIS 7.5上存储cookie数据


Cannot store cookie data on IIS 7.5

这是我的问题;我目前正在开发CodeIgniter应用程序,客户希望我们将其部署在IIS服务器上。

我的开发人员机器是一个运行IIS 7.5的Windows7盒子,我的应用程序运行得很好。当我将它部署到远程计算机(Windows 2008服务器)时,问题就开始了。在那里,我无论如何都不能使用会话。

我的猜测是这是一个服务器问题,因为如果我试图将以下行添加到我的Sessions.php文件中

function _set_cookie($cookie_data = NULL)
{
    if (is_null($cookie_data))
    {
        $cookie_data = $this->userdata;
    }
    // Serialize the userdata for the cookie
    $cookie_data = $this->_serialize($cookie_data);
    if ($this->sess_encrypt_cookie == TRUE)
    {
        $cookie_data = $this->CI->encrypt->encode($cookie_data);
    }
    else
    {
        // if encryption is not used, we provide an md5 hash to prevent userside tampering
        $cookie_data = $cookie_data.md5($cookie_data.$this->encryption_key);
    }
    $expire = ($this->sess_expire_on_close === TRUE) ? 0 : $this->sess_expiration + time();
    // Set the cookie
    setcookie(
                $this->sess_cookie_name,
                $cookie_data,
                $expire,
                $this->cookie_path,
                $this->cookie_domain,
                $this->cookie_secure
            );
//This is the added line
var_dump($_COOKIE);die;
}

我得到的只是

Array()

这意味着原生的setcookie函数不会做任何事情。。。感谢您抽出时间!

[EDIT]

如果我将cookie_secure标志设置为false,则会话似乎可以工作。。。它现在确实有效,但我似乎不明白为什么。。。我会让这个话题在几天内悬而未决,以防有人能解释为什么会发生这种情况:/

cookie_secure标志等于true的文档要求用户代理(浏览器)对要设置的任何cookie使用https。你在测试中使用了https吗?