Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27472

VS 2010 Importing url list uri error

$
0
0
Hey Guys,

I have coded a small application to format URLs using the code:

Code:

        '// First split the HOST/USERNAME/PASSWORD
        Dim stringArray As String() = strAccount.Split(" ")
        Dim stringURI As String
        Dim stringUser As String
        Dim stringPass As String
        Dim newURL As String

        stringURI = stringArray(0)
        stringUser = stringArray(1)
        stringPass = stringArray(2)

        '// Check if the string URL contains "http://" if not add it...
        If (stringURI.Contains("http://")) Or stringURI.Contains("https://") Then
            stringURI = stringArray(0)
        Else
            stringURI = "http://" & stringArray(0)
        End If

        If stringURI.StartsWith("www") Then
            stringURI = "http://" & stringArray(0)
        End If

When importing the URLs everything works fine until it hits a url that starts with: www

site.com <-- this imports fine i can add the "http://"
www.site.com <-- this one throws an error [Invalid URI the hostname could not be parsed]

i tried to compensate for it above but it doesn't seem to work, i'm not sure what i have done wrong.

any help would be appreciated :)

thanks guys

Graham

Viewing all articles
Browse latest Browse all 27472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>