惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Security Blog
Microsoft Security Blog
P
Proofpoint News Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Martin Fowler
Martin Fowler
G
Google Developers Blog
F
Fortinet All Blogs
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google DeepMind News
Google DeepMind News
Google Online Security Blog
Google Online Security Blog
Hacker News: Ask HN
Hacker News: Ask HN
T
Tailwind CSS Blog
Cloudbric
Cloudbric
U
Unit 42
MyScale Blog
MyScale Blog
TaoSecurity Blog
TaoSecurity Blog
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
博客园 - Franky
AI
AI
爱范儿
爱范儿
L
LangChain Blog
小众软件
小众软件
D
DataBreaches.Net
M
MIT News - Artificial intelligence
GbyAI
GbyAI
Y
Y Combinator Blog
有赞技术团队
有赞技术团队
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
The Cloudflare Blog
Help Net Security
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Privacy International News Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Docker
A
About on SuperTechFans
Scott Helme
Scott Helme
The GitHub Blog
The GitHub Blog
V
V2EX
N
Netflix TechBlog - Medium
S
Security Affairs
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Heimdal Security Blog
WordPress大学
WordPress大学

博客园 - 亲,注意身体

magento 数据清理 magento top menu edit magento sitemap cms page remove home and generate sitemap error magento toplink blank li magento 语言包 magetno awblog auto generate title id, js replace magento moneybooker 操作 JS 正则 js 数组 组合(转) magento checkout require moneybooker api/mqi query magento 记录蜘蛛爬行日志 magento moneybooker redirect 添加信任站点 bat 设置信任站点等级 moneybooker api 文档 magento htaccess Navicat 注册码,序列号 magento 修改订单号 Magento 删除所有订单 适于于1.4+
CookieConter 转换为string
亲,注意身体 · 2012-11-09 · via 博客园 - 亲,注意身体

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;
    }

posted on 2012-11-09 14:54  亲,注意身体  阅读(899)  评论()    收藏  举报