title: How to check if a url is valid or not
body: <p>I am trying to filter out invalid url from valid ones using .NET.</p>
  
  <p>I am using <a href="http://msdn.microsoft.com/en-us/library/ms131573.aspx" rel="nofollow">Uri.TryCreate()</a> method for this.</p>
  
  <p>It has the following syntax</p>
  
  <pre><code>public static bool TryCreate(Uri baseUri,string relativeUri,out Uri result)
  </code></pre>
  
  <p>Now I am doing this....</p>
  
  <pre><code>Uri uri = null;
  
  var domainList = new List&lt;string&gt;();
  domainList.Add("asas");
  domainList.Add("www.stackoverflow.com");
  domainList.Add("www.codera.org");
  domainList.Add("www.joker.testtest");
  domainList.Add("about.me");
  domainList.Add("www.ma.tt");
  
  var correctList = new List&lt;string&gt;();
  
  foreach (var item in domainList)
  {
      if(Uri.TryCreate(item, UriKind.RelativeOrAbsolute, out uri))
      {    
          correctList.Add(item);
      }
  }
  </code></pre>
  
  <p>I am trying the above code I expect it to remove <code>asas</code> and <code>www.joker.testtest</code> from the list, but it doesnt.</p>
  
  <p>Can some one help me out on this.</p>
  
  <p>Update :
  just tried out with <code>Uri.IsWellFormedUriString</code> this too did'nt help.</p>
  
  <p><strong>More Update</strong></p>
  
  <p>List of Valid uri</p>
  
  <ul>
  <li><a href="http://www.ggogle.com" rel="nofollow">http://www.ggogle.com</a></li>
  <li>www.abc.com</li>
  <li>www.aa.org</li>
  <li>www.aas.co</li>
  <li>www.hhh.net</li>
  <li>www.ma.tt</li>
  </ul>
  
  <p>List of invalid uri</p>
  
  <ul>
  <li>asas</li>
  <li>as#@SAd</li>
  <li>this.not.valid</li>
  <li>www.asa.toptoptop</li>
  </ul>