Home >

Difference between UriBuilder.ToString and UriBuilder.Uri.ToString

8. March 2011

UriBuilder.ToString - The resulting string always contains port, even if it is the default port. For example - http://localhost:80/wiktips

UriBuilder.Uri.ToString - The resulting string only contains the port if it is not the default port for the scheme. For example - http://localhost/wiktips

Therefore, in most of the cases UriBuilder.Uri.ToString should be used to omit redundant port specification.

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading