0

How can block url in asp? here i could only when the input is https://www.myopenid.com ie,

when it starts with https://www.myopenid . But i want to block the input in the following cases

1) www.myopenid.com (here .com ,.in ,.org etc)

2) myopenid.com

I give asp code below that i used:

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

Dim regEx, Name, Address


Address = Request("Address") 



Function validateEmail(Address) 
  Set regEx = New RegExp 
  regEx.IgnoreCase = False

   regEx.Pattern = "(http|https)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?" 


   validateEmail = regEx.Test(Trim(Address)) 
End Function

If Request.Form.Count > 0 Then
  If validateEmail(Request.Form("Address")) Then
    Response.Write("Access Denied Avoid Link")
    Response.End

  Else


  End If
End If

%>

code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Block URL</title>

</head>
<body>

           <form method="post" action="">
           <table border="0" width="450" cellspacing="0" cellpadding="0">


            <tr>
            <td>
            Address:
            </td>
            <td>
            <textarea rows="2" name="address" cols="20"></textarea>
            </td>
            </tr>


            <tr>
            <td>
            </td>
            <td>
            </td>
            </tr>     


            <tr>
            <td>
            </td>
            <td>
            <input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2">
            </td>
            </tr>    

           </table>

           </form>
</body>
</html>

I use the following site for reffer

http://www.webmaster-talk.com/asp-forum/99462-form-validation-with-asp-classic.html

I already used many regEx Pattern for answer, but only block the input starting with

https://www.myopenid.com

I bloked the url passing via textboxs and textarea in php by the following code .It is ok for all input cases in 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');



  }

  }

Pls do help me.............

Edited by mike_2000_17: Fixed formatting

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by ArtistScope
0

Use something like..

if instr(url, sample) > 0 then
'do something
end if

Where URL is link and SAMPLE is the domain part (myopenid).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.