Skip to content

Instantly share code, notes, and snippets.

@cmatskas
Created April 12, 2015 21:23
Show Gist options
  • Save cmatskas/fd16cf7598d950faf4e7 to your computer and use it in GitHub Desktop.
Save cmatskas/fd16cf7598d950faf4e7 to your computer and use it in GitHub Desktop.
public static Uri CreateUri(int port = 80)
{
var host = Process.GetProcessesByName("fiddler").Any() ? "ipv4.fiddler" : "localhost";
var portNumber = port == 80 ? string.Empty : ":" + port;
return new Uri("http://" + host + portNumber);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment