Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In php we use the following code to block the url link passing via text boxes or textarea on form submit(For avoid bad link passing from contact us form ).Is there any methode like this in classic asp using vb.

PHP
if($_POST['Register'])
{
    $username=$_POST['username'];
    if (preg_match('~(?:[a-z0-9+.-]+://)?(?:\w+\.)+\w{2,6}\S*~i', $username))
    {
         die('Access Denied Avoid Link');
                        
    }
}


I use the following code in asp but shows error

<%@Language=VBScript%>
<%
Option Explicit

Dim Address 
Address = Request("Address") 

if(!preg_match("/^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i",& Address&))
{
Echo"Access Denied Avoid Link.";
Response.End
'Exit();
}
%>

Please help me. :doh:
Posted
Updated 8-Oct-10 21:17pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900