I think the important question is what the URL validation is used for. The only times I have needed such validation, have been for storing static URLs, like home pages, facebook accounts and similar stuff. The client wanted some notification when seemingly wrong URLs were entered, but if the "probably wrong URL" warning was ignored, the entered value was accepted.
>It's the question what to test. Valid URL or existence of a connection?
>
>Valid URL is a pain.
>
>
http://user:password@fee.foo:1234/path/file?ask=not#Target0>
>Is perfectly valid syntax for a URL...
>
>
localhost>is valid
>
http://[::1]>is valid
>
https:/127.0.0.1>is valid
>
https://shop.heise.de/sonstiges/../.>is valid.
>
>We have umlaut domains right now - and one would expect that the input box will recieve öüä and translate them accordingly. (Even I think it's a fail)
>
>One can just get the URL, do (in a second field or on every use) the translations one need to deal with umlaut etc. And try if one need it if one can reach the host.
>
>Syntax check will not solve the problem of moving targets. :)
>
>
>
>>Since a website can be down at the moment and they are frequently changed, I wouldn't include a check for the presence of the URL in a validation function.
>>
>>>Doesn't seem to work reliably.
>>>
>>>I tried invalid URL first, then valid URL, then
http://stackoverflow.com/questions/161738.com (invalid) and it didn't give me any message.
>>>
>>>>
>>>>local m.url,m.Result
>>>>m.url="https://www.levelextreme.com/ViewPageGenericLogin.aspx"
>>>>
>>>>DECLARE INTEGER InternetCheckConnection IN wininet STRING lpszUrl, INTEGER dwFlags, INTEGER dwReserved
>>>>#DEFINE FLAG_ICC_FORCE_CONNECTION 1
>>>>
>>>>LOCAL llResult
>>>>m.lResult = (InternetCheckConnection(m.URL, FLAG_ICC_FORCE_CONNECTION, 0) = 1)
>>>>if m.lResult=.t.
>>>>messagebox("Valid URL",0+32+4096,'',1000)
>>>>else
>>>>messagebox("inValid URL",0+32+4096,'',1000)
>>>>endi
>>>>
>>>>
>>>>see also this:http://www.sourcecodester.com/tutorials/c/7296/url-validation-using-c.html
>>>>if you can translate to vfp (regExp)