VBScript provides a RegExp object that can be used with a regular expression matching URL's.
Trying finding a suitable one for your case at regexlib.com. Remember that this method only validates if the URL format matches known formats. It does not validate if the URL actually exists. On Apr 9, 6:39 pm, Fusion <[email protected]> wrote: > I want validate URL comming from Form. What happen if url has no http:// > or www? > > <!-- Author: Adrian Forbes --> > <!-- Filename: ValidateURL.asp --> > <% > if len(trim(Request("txtURL"))) > 0 then > iStatus = 0 > sURL = trim(Request("txtURL")) > if sURL is empty sURL = "http://www.fusionedv.com" ; > 'Set obj = CreateObject("Microsoft.XMLHTTP") > Set obj = CreateObject("MSXML2.XMLHTTP") > on error resume next > obj.open "GET", sURL, False > obj.send > if err.number = 0 then > iStatus = obj.Status > end if > on error goto 0 > > if iStatus = 200 then > Response.write "<p>The URL is valid, status is " & iStatus & "</p>" > & > vbCRLF > else > Response.write "<p>The URL is invalid, status is " & iStatus & "</ > p>" & > vbCRLF > end if > end if > %> > > <form action="ValidateURL.asp"> > URL: <input type=text name=txtURL><br> > <input type=submit value="Validate URL"> > </form> -- You received this message because you are subscribed to the Google Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en or visit the group website at http://megasolutions.net
