Cookiecontainer convert to cookies and write to IE to remain logged in

Source: Internet
Author: User

1   Public StaticList<cookie>getallcookies (cookiecontainer cc)2         {3List<cookie> lstcookies =NewList<cookie>();4Hashtable table = (Hashtable) cc. GetType (). InvokeMember ("m_domaintable",5System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetField |6System.Reflection.BindingFlags.Instance,NULLCcNew Object[] { });7             foreach(ObjectPathListinchtable. Values)8             {9SortedList Lstcookiecol = (SortedList) pathlist.gettype (). InvokeMember ("m_list",TenSystem.Reflection.BindingFlags.NonPublic |System.Reflection.BindingFlags.GetField One| System.Reflection.BindingFlags.Instance,NULL, PathList,New Object[] { }); A                 foreach(Cookiecollection colcookiesinchlstcookiecol.values) -                     foreach(Cookie Cinchcolcookies) Lstcookies.add (c); -             } the             returnlstcookies; -}
 Public Static BOOLStartie (Cookiecontainer cc,stringURL) {            Try{List<Cookie> tempcookies =getallcookies (CC); foreach(Cookie IinchTempcookies.toarray ()) {InternetSetCookie (URL, i.name.tostring (), i.value.tostring ()+"; expires=sun,22-feb-2099 00:00:00 GMT"); }                return true; }            Catch{return false; } }

1 System.Diagnostics.Process.Start ("iexplore.exe", open URL);

Cookiecontainer convert to cookies and write to IE to remain logged in

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.