ASP verify that the input URL is valid and can be accessed with the regular authentication input URL _ application Tips

Source: Internet
Author: User

Core code:

Verify that the input URL is valid and can access the <% ' ****************************** ' function: Urlok (strurl) ' parameter: strURL, to be verified URL ' date: 2007/7/13 ' Description: Verify that the input URL Valid and accessible ' Example: <%=urlok (' http://www.jb51.net ')%> ' ****************************** Function Urlok (strurl) on Error R Esume Next If strurl<> "" "Then Set objhttp = CreateObject (" MSXML2. 
 XMLHTTP ") Objhttp.open" get ", strURL, FALSE objhttp.send If InStr (Objhttp.statustext," OK ") Then Urlok =" valid "Else 
Urlok = "Invalid" End If Else Urlok = "Error: You did not enter the URL!" The End If End Function%> a regular authentication url <% ' ****************************** ' function: Checkexp (PATRN,STRNG) ' parameter: patrn Regular expression; strng validation string ' Author: Arisisi ' Date: 2007/7/13 ' Description: Regular validation url ' example of whether the input URL is legitimate: <%=checkexp (patrn,strng)%> ' **************** 
function Checkexp (patrn,strng) Dim regex,match Set regex = new RegExp ' establishes a regular expression. 
Regex.pattern = Patrn ' Set mode. 
Regex.ignorecase = True ' Sets whether character case is case-sensitive. 
Regex.global = True ' sets global availability. matches = Regex.test (strng) checkexp = Matches End Function 
%>  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.