title: Cookie Domain not valid C#
body: <p>I making a request of a third-party web service and writing my C# code (.net 4.0) based on a VB.net program (.net 3.5).  I'm pretty much copying the commands exactly, but no matter what I add as the domain to my cookie, it doesn't work and always gives me the error when i add the cookie to the container.  </p>
  
  <p>The 'Domain'='<a href="https://secure.uat.globallink.com/gtss/service/FileWebService" rel="nofollow">https://secure.uat.globallink.com/gtss/service/FileWebService</a>' part of the cookie is invalid.</p>
  
  <p>The VB.net program works fine with this code and in production.  I have no idea why this is happening.  The .add method is the same between 3.5 and 4.0 and I've tried this BugFix_CookieDomain code that is floating around on the internet with no help (I only have this one cookie).  I've also tried adding a URI field with no luck and changing the domain to "<a href="https://secure.uat.globallink.com" rel="nofollow">https://secure.uat.globallink.com</a>" but nothing is working.  Please help, I feel like I'm going a bit bonkers here.  Thanks!</p>
  
  <p>C#</p>
  
  <pre><code> GTSSWebService.FxWebService wsDL = new GTSSWebService.FxWebService();
  
                  wsDL.Credentials = new NetworkCredential(connectionCreds, Settings.mySettings.GTSSPassword);
                  wsDL.CookieContainer = new CookieContainer();
  
  
                  wsDL.Url = "https://secure.uat.globallink.com/gtss/service/FxWebService";
                  Cookie gtssConnCookie = new Cookie("SMCHALLENGE", "YES");
                  gtssConnCookie.Domain = "https://secure.uat.globallink.com/gtss/service/FileWebService";
                  wsDL.CookieContainer.Add(gtssConnCookie);
  </code></pre>
  
  <p>vb</p>
  
  <pre><code>Dim wsDL As New GTSSWebService.FxWebService
  
              wsDL.Credentials = New System.Net.NetworkCredential(sCreds, Settings.DefaultSettings.PW)
              wsDL.CookieContainer = New System.Net.CookieContainer
  
              If Settings.DefaultSettings.ConnectLTS Then
                  wsDL.Url = "http://" &amp; Settings.DefaultSettings.LTSIP &amp; "/gtss/service/FxWebService"
              Else
                  wsDL.Url = Settings.DefaultSettings.GTSSURL.Replace("/FileWebService", "/FxWebService")
                  Dim GTSSConnectionCookie As New Cookie("SMCHALLENGE", "YES")
                  GTSSConnectionCookie.Domain = Settings.DefaultSettings.GTSSURL
                  wsDL.CookieContainer.Add(GTSSConnectionCookie)
  </code></pre>
  
  <p><strong>NOTE - Settings.DefaultSettings.GTSSURL == "<a href="https://secure.uat.globallink.com/gtss/service/FileWebService" rel="nofollow">https://secure.uat.globallink.com/gtss/service/FileWebService</a>"</strong></p>