Search code examples
c#mono

When does Uri.CheckHostName() return UriHostNameType.Basic instead of UriHostNameType.Dns or UriHostNameType.Unknown?


The documentation at http://msdn.microsoft.com/en-us/library/system.urihostnametype.aspx and http://msdn.microsoft.com/en-us/library/system.uri.checkhostname.aspx is a bit unclear.

Uri.CheckHostName(string) returns UriHostNameType.Dns for a valid DNS hostname, and it returns UriHostNameType.Unknown when the string contains invalid characters and so on. Under what conditions does this method ever return UriHostNameType.Basic?


Solution

  • Now the .NET Core is open source we can know for sure.

    Just like Mono, it never returns UriHostNameType.Basic.

    Link to source code