Created
July 8, 2011 23:47
-
-
Save murven/1073101 to your computer and use it in GitHub Desktop.
How to check if an URI is FTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uri sourceBaseUri; | |
var isValidUri = Uri.TryCreate("ftp://somedomain.com/somefolder/someotherfolder/somefile.zip", UriKind.Absolute, out sourceBaseUri); | |
if(isValidUri) | |
{ | |
Console.WriteLine("URI is valid"); | |
} | |
if(sourceBaseUri.Scheme == Uri.UriSchemeFtp) | |
{ | |
Console.WriteLine("URI is FTP"); | |
} | |
if(sourceBaseUri.Scheme == Uri.UriSchemeFile) | |
{ | |
Console.WriteLine("URI is File"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment