Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

valid 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

Comment

valid URL check in c#

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

PREVIOUS NEXT
Code Example
Csharp :: read file using c# 
Csharp :: unity create empty gameobject in code 
Csharp :: switch expression c# multiple cases 
Csharp :: c# convert list t to datatable 
Csharp :: get property value from object c# 
Csharp :: asp.net textarea disable resize 
Csharp :: c# create tasks and wait all 
Csharp :: c# linq distinct group by nested list 
Csharp :: vector2 with switch statement 
Csharp :: how to deactivate an object unity 
Csharp :: unity gui text 
Csharp :: sqldatareader in c# 
Csharp :: unity 2d 
Csharp :: copy class c# 
Csharp :: an existing connection was forcibly closed by the remote host. .net core 
Csharp :: checking if a list contains a value unity 
Csharp :: c# get property type of list 
Csharp :: linq sum 
Csharp :: c# combobox add item 
Csharp :: c# close program 
Csharp :: add row and columns to grid wpf in code 
Csharp :: pyautopgui wrros on big sur 
Csharp :: c# allowedusernamecharacters 
Csharp :: string tochar array c# 
Csharp :: set current date to textbox in asp.net 
Csharp :: unity guid to object 
Csharp :: how to show process time run c# 
Csharp :: unity button not working 
Csharp :: c# combobox lock edit 
Csharp :: unity scroll rect to bottom 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =