Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:42:41+00:00 2026-06-11T07:42:41+00:00

I am trying to filter out invalid url from valid ones using .NET. I

  • 0

I am trying to filter out invalid url from valid ones using .NET.

I am using Uri.TryCreate() method for this.

It has the following syntax

public static bool TryCreate(Uri baseUri,string relativeUri,out Uri result)

Now I am doing this….

Uri uri = null;

var domainList = new List<string>();
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<string>();

foreach (var item in domainList)
{
    if(Uri.TryCreate(item, UriKind.RelativeOrAbsolute, out uri))
    {    
        correctList.Add(item);
    }
}

I am trying the above code I expect it to remove asas and www.joker.testtest from the list, but it doesnt.

Can some one help me out on this.

Update :
just tried out with Uri.IsWellFormedUriString this too did’nt help.

More Update

List of Valid uri

  • http://www.ggogle.com
  • http://www.abc.com
  • http://www.aa.org
  • http://www.aas.co
  • http://www.hhh.net
  • http://www.ma.tt

List of invalid uri

  • asas
  • as#@SAd
  • this.not.valid
  • http://www.asa.toptoptop
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:42:43+00:00Added an answer on June 11, 2026 at 7:42 am

    You seem to be confused about what exactly URL (or URI, the difference is not significant here) is. For example, http://stackoverflow.com is a valid absolute URL. On the other hand, stackoverflow.com is technically a valid relative URL, but it would refer to the file named stackoverflow.com in the current directory, not the website with that name. But stackoverflow.com is a registered domain name.

    If you want to check whether a domain name is valid, you need to define what exactly do you mean by “valid”:

    1. Is it a valid domain name? Check whether the string consists of parts separated by dots, each part can contain letters, numbers and a hyphen (-). For example, asas and this.not.valid are both valid domain names.
    2. Could it be an Internet domain name? Domain names on the Internet (as opposed to intranet) are specific in that they always have a TLD (top-level domain). So, asas certainly isn’t an Internet domain name, but this.not.valid could be.
    3. Is it a domain name under existing TLD? You can download the list of all TLDs and check against that. For example, this.not.valid wouldn’t be considered valid under this rule, but thisisnotvalid.com would.
    4. Is it a registered domain name?
    5. Does the domain name resolve to an IP address? A domain name could be registered, but it still may not have an IP address in its DNS record.
    6. Does the computer the domain name points to respond to requests? The requests that make the most sense are a simple HTTP request (e.g. trying to access http://domaininquestion/) or ping.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Magento 1.3 I'm trying to filter out of stock items from the productCollection. Using:
I'm trying to filter out invalid user inputs in a small C++ program using
Scraping pages using BeautifulSoup; trying to filter out links that end in ...html#comments Code
I'm trying to filter out some garbage text from a string with regex but
I am trying to filter out the noise from the orientation/compass sensor in my
I'm trying to filter out all possibilities of XSS from user name input while
I have been trying unsuccessfully to find a way to filter out records from
I am trying to filter out the duplicates of a subset of columns from
I am trying to filter out unwanted data from an XML file. I have
I'm trying to filter out a table using filter in the outer join clause

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.