using System.Collections.Generic;
public static void Main()
var tests = new List<string> {
"https://twitter.com/test",
"http://twitter.com/test",
"https://twitter.com/test?hello=hello",
foreach (var test in tests)
Console.WriteLine(string.Format("{0}: {1}", test, IsValidUri(test)));
public static string IsValidUri(string uri)
if (uri.IndexOf("/") != -1)
validUri = new UriBuilder(uri).Uri.AbsolutePath;
return validUri.Substring(0, 1) == "/" ? validUri.Substring(1) : validUri;