title: CookieContainer bug?
body: <p>I'm confused how CookieContainer handles domain, so I create this test.
  This test shows cookieContainer doesn't return any cookie for "example.com" but according to RFC it should return at least 2 cookies.</p>
  
  <p>Isn't it a bug?</p>
  
  <p>How make it to work?</p>
  
  <p>Here is a discussion about this bug:</p>
  
  <p><a href="http://social.msdn.microsoft.com/Forums/en-US/ncl/thread/c4edc965-2dc2-4724-8f08-68815cf1dce6" rel="noreferrer">http://social.msdn.microsoft.com/Forums/en-US/ncl/thread/c4edc965-2dc2-4724-8f08-68815cf1dce6</a></p>
  
  <pre><code>&lt;%@ Page Language="C#" %&gt;
  
  &lt;%@ Import Namespace="System.Net" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;script runat="server"&gt;
      CookieContainer getContainer()
      {
          CookieContainer result = new CookieContainer();
  
          Uri uri = new Uri("http://sub.example.com");
          string cookieH = @"Test1=val; domain=sub.example.com; path=/";
          result.SetCookies(uri, cookieH);
  
          cookieH = @"Test2=val; domain=.example.com; path=/";
          result.SetCookies(uri, cookieH);
  
          cookieH = @"Test3=val; domain=example.com; path=/";
          result.SetCookies(uri, cookieH);
  
          return result;
      }
  
      void Test()
      {
          CookieContainer cookie = getContainer();
          lblResult.Text += "&lt;br&gt;Total cookies count: " + cookie.Count + " &amp;nbsp;&amp;nbsp; expected: 3";
  
          Uri uri = new Uri("http://sub.example.com");
          CookieCollection coll = cookie.GetCookies(uri);
          lblResult.Text += "&lt;br&gt;For " + uri + " Cookie count: " + coll.Count + " &amp;nbsp;&amp;nbsp; expected: 2";
  
          uri = new Uri("http://other.example.com");
          coll = cookie.GetCookies(uri);
          lblResult.Text += "&lt;br&gt;For " + uri + " Cookie count: " + coll.Count + " &amp;nbsp;&amp;nbsp; expected: 2";
  
          uri = new Uri("http://example.com");
          coll = cookie.GetCookies(uri);
          lblResult.Text += "&lt;br&gt;For " + uri + " Cookie count: " + coll.Count + " &amp;nbsp;&amp;nbsp; expected: 2";
  
      }
  
      protected void Page_Load(object sender, EventArgs e)
      {
          Test();
      }
  &lt;/script&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head runat="server"&gt;
      &lt;title&gt;CookieContainer Test Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="frmTest" runat="server"&gt;
      &lt;asp:Label ID="lblResult" EnableViewState="false" runat="server"&gt;&lt;/asp:Label&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>