How to: Extract a Protocol and Port Number from a URL
.NET Framework 3.0
The following code example uses Match.Result to extract a protocol and port number from a URL. For example, "http://www.contoso.com:8080/letters/readme.html" would return "http:8080".