/* get current cookies */ public CookieCollection getCurCookies() { return curCookies; }
例 9.3. getCurCookies 的使用范例
string primeRespHtml = getSkydriveRespHtmlLogin(ref resp); skydriveCookies = getCurCookies();
另外【已解决】又发现一个C#中解析Set-Cookie的一个bug:无故地添加cookie的path域中的一个例子:
crl = new crifanLib(); HttpWebResponse addNk1Response = crl.getUrlResponse(addNk1Url, headerDict: headerDict, postDict: postDict);//<script>location.href='/add/'</script> String curDomain = crl.extractHost(addPhpUrl);//new.guguyu.com CookieCollection parsedCookies = crl.parseSetCookie(addNk1Response.Headers["Set-Cookie"], curDomain); CookieCollection curCookies = crl.getCurCookies(); crl.updateLocalCookies(parsedCookies, ref curCookies); crl.setCurCookies(curCookies);