I am trying to pass a Uri of new Uri(".example.com")
Invalid URI: The format of the URI could not be determined.
or new Uri("http://.example.com")
Invalid URI: The hostname could not be parsed.
I need to be able to use the CookieContainer.SetCookies function which only has one overload taking a Uri.
According to this page, .NET 4.0 should support dot prefixed cookies now, but it seems the Uri class does not?
In this case, you need to pass a proper uri to the function, and the Uri parser is correctly rejecting the malformed string you are trying to use.
I would advise using the Cookie Constructor that takes 4 parameters – allowing you to set the domain to a dot-prefixed one.