Note that there are some explanatory texts on larger screens.

plurals
  1. POWebClient not sending all the cookies
    primarykey
    data
    text
    <p>I'm using a web client that is cookie aware</p> <pre><code>public class CookieAwareWebClient : WebClient { public CookieContainer m_container = new CookieContainer(); protected override WebRequest GetWebRequest(Uri address) { WebRequest request = base.GetWebRequest(address); if (request is HttpWebRequest) { (request as HttpWebRequest).CookieContainer = m_container; } return request; } public CookieCollection Cookies(Uri domain) { return m_container.GetCookies(domain); } } </code></pre> <p>And making a few request to a web site that drops a set of cookies like this</p> <pre><code>webClient.Cookies(new Uri("http://&lt;domain&gt;.com")).Cast&lt;Cookie&gt;().ToArray() {System.Net.Cookie[7]} [0]: {UsrLocale=en_CA} [1]: {Country=CA} [2]: {$Version=1; ca_ord="UJMupexgTADsaH1yNi9eyA=="; $Path=/; $Domain=.&lt;domain&gt;.com} [3]: {isLoggedin=false} [4]: {cartCount=1} [5]: {userPrefLanguage=en_CA} </code></pre> <p>The next request doesn't work as expected, and when I look in fiddler I see that cookie[2] hasn't been added to the headers. This one is pretty important by the looks of things. Does anyone know why it wouldn't be added to the request? All the others get popped in fine, and the domain I'm making a request to is a subdomain of the one listed in the cookie i.e. subDomain..com</p> <pre><code>var domain = new Uri("http://domain.com"); var webClient = new CookieAwareWebClient(); webClient.OpenRead("http://sub.domain.com"); webClient.RefreshCookies(domain); webClient.UploadValues("http://sub.domain.com/browse/submit.jsp", new NameValueCollection { {"productId","prod610181"}, {"skuId","3431733"}, {"quantity","1"}, {"page","MAIN"} }); webClient.RefreshCookies(domain); webClient.OpenRead("http://sub.domain.com/shopping/bag.jsp"); webClient.RefreshCookies(domain); var order = webClient.Cookies(new Uri("http://domain.com")).Cast&lt;Cookie&gt;().ToArray(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload