URL Validation

Static Server boolean validateURL(URL _url)
{
Boolean valid;
Boolean xppBool;
System.Boolean netBool;

Str matchURLPattern = “^(https?://)”
+ “?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?” //user@+ @”(([0-9]{1,3}.){3}[0-9]{1,3}” // IP- 199.194.52.184+ “|” // allows either IP or domain+ @”([0-9a-z_!~*'()-]+.)*” // tertiary domain(s)- http://www.+ @”([0-9a-z][0-9a-z-]{0,61})?[0-9a-z].” // second level domain+ “[a-z]{2,6})” // first level domain- .com or .museum+ “(:[0-9]{1,4})?” // port number- :80+ “((/?)|” // a slash isn’t required if there is no file name+ “(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$”;

System.Text.RegularExpressions.Match myMatch;

new InteropPermission(InteropKind::ClrInterop).assert();

myMatch = System.Text.RegularExpressions.Regex::Match(_url,matchURLPattern);

netBool = myMatch.get_Success(); xppBool = netBool;

CodeAccessPermission::revertAssert(); Return xppBool;

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: