❔ What's the best way to test a URL that's it's valid?

I have a situation where the user can enter a URL if they so choose, but if they do, I want to ensure it's valid. How would I do that? Should I use a regular expression test or something else? Normally, this will be a website on the Internet in my case.
4 Replies
0xDEADBEEF
0xDEADBEEF2y ago
Uri.TryCreate Method (System)
Creates a new Uri. Does not throw an exception if the Uri cannot be created.
Will Pittenger
Will PittengerOP2y ago
OK. Thanks.
Mayor McCheese
IdnMapping Class (System.Globalization)
Supports the use of non-ASCII characters for Internet domain names. This class cannot be inherited.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?