//Regex reg = new Regex(@"^(http|https|ftp)/://[a-zA-Z0-9/-/.]+/.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9/-/._/?/,/'+&%/$#/=~])*$"); this regular expression can't validate http://localhost:8580/peoject.aspx
Regex reg = new Regex(@"^(http|https|ftp)/://[a-zA-Z0-9/-/.]+(/.[a-zA-Z]{2,3})*(:(0-9)*)?/?([a-zA-Z0-9/-/._/?/,/'+&%/$#/=~])*$");//this expression has more security
if(reg.Match(inputURL.ToString()).Success )
{
//this is a safe url
}