“Gültige URL in .net” Code-Antworten

Gültige URL in .net

//Try this to validate HTTP URLs (url is the URI you want to test):
//
	// Checks how well a url validator does against a known list of valid and invalid Urls
	// The sample urls here are from http://formvalidation.io/validators/uri
	//	
// test 
/// in text this only one that most low (17) error
public static bool UrlChecker5(string url)
	{
		Uri uriResult;
		bool result = Uri.TryCreate(url, UriKind.Absolute, out uriResult) 
			&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
       return result;
	}
// and than (17)

public static bool UrlChecker2(string url)
	{
		return Uri.IsWellFormedUriString(url, UriKind.Absolute);
	}
// if we combine both with like UrlChecker5(url) && UrlChecker2(url)
// error become lowest 15 error

code fighter

Gültige URL -Check in C#

public static bool CheckURLValid(this string source) => Uri.TryCreate(source, UriKind.Absolute, out Uri uriResult) && uriResult.Scheme == Uri.UriSchemeHttps;
Enchanting Elephant

Ähnliche Antworten wie “Gültige URL in .net”

Fragen ähnlich wie “Gültige URL in .net”

Weitere verwandte Antworten zu “Gültige URL in .net” auf C#

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen