public static string GetCookieString(System.Net.CookieContainer cc)
    {
        string str = "";
        List<Cookie> listcookie = GetAllCookies(cc);
        foreach (Cookie c in listcookie)
        {
            string name = c.Name;
            string value = c.Value;
            string domain = c.Domain;
            str += name + "=" + value + ";domain=" + domain + "\n";
        }

        return str;
    }
    /// <summary>
    /// 获取CookieContainer中对象
    /// </summary>
    /// <param name="cc"></param>
    /// <returns></returns>
    private static List<Cookie> GetAllCookies(CookieContainer cc)
    {
        if (cc == null)
        {
            return new List<Cookie>();
        }
        List<Cookie> lstCookies = new List<Cookie>();

        System.Collections.Hashtable table = (System.Collections.Hashtable)cc.GetType().InvokeMember("m_domainTable", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Instance, null, cc, new object[] { });

        foreach (object pathList in table.Values)
        {
            System.Collections.SortedList lstCookieCol = (System.Collections.SortedList)pathList.GetType().InvokeMember("m_list", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField | System.Reflection.BindingFlags.Instance, null, pathList, new object[] { });
            foreach (CookieCollection colCookies in lstCookieCol.Values)
                foreach (Cookie c in colCookies) lstCookies.Add(c);
        }

        return lstCookies;
    }