1         private void BugFix_CookieDomain(CookieContainer cookieContainer)
 2         {
 3             System.Type _ContainerType = typeof(CookieContainer);
 4             Hashtable table = (Hashtable)_ContainerType.InvokeMember("m_domainTable",
 5                                        System.Reflection.BindingFlags.NonPublic |
 6                                        System.Reflection.BindingFlags.GetField |
 7                                        System.Reflection.BindingFlags.Instance,
 8                                        null,
 9                                        cookieContainer,
10                                        new object[] { });
11             ArrayList keys = new ArrayList(table.Keys);
12             foreach (string keyObj in keys)
13             {
14                 string key = (keyObj as string);
15                 if (key[0] == '.')
16                 {
17                     string newKey = key.Remove(0, 1);
18                     table[newKey] = table[keyObj];
19                 }
20             }
21         }
View Code

 

posted on 2013-12-07 14:16  CodeBase  阅读(315)  评论(0编辑  收藏  举报