• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

ASP - help needed

puzo

New Member
Hi,
I would like to input this code on my index.asp page:

If Request.ServerVariables("REMOTE_ADDR") = "xxx.xxx.xxx.xxx" 'spammer IP Then
Response.Redirect "http://www.disney.com"
End If

Where exactly do i put it? iv'e tried putting it after the <HTML> tags but its a no go because it just shows this text, and doesnt preform the action.
Does any1 know how to make it work?

Thanks,

Mike
 
you have to add <% and %> like this

<%
If Request.ServerVariables("REMOTE_ADDR") = "xxx.xxx.xxx.xxx" 'spammer IP Then
Response.Redirect "http://www.disney.com"
End If
%>
 
I get a "500 Internal Server error" (http://puzo.org/test.asp)
here's my HTML code: (correct me if im wrong)

<html>
<br><h2><center>Test Page</center></h2>
<%
If Request.ServerVariables("REMOTE_ADDR") = "212.199.*.*" 'spammer IP Then
Response.Redirect "http://www.disney.com"
End If
%>
</html>

PuZo
 
Response.Redirect should be placeed before any output is send to the browser. The best place also is the first line of you code before the html tag. This way you are sure nothing is send to the browser. Also i would remove the comment tag as it might obscure the then part of your code.
 
<%
If Request.ServerVariables("REMOTE_ADDR") = "212.199.*.*" 'spammer IP Then
Response.Redirect "http://www.disney.com"
End If
%>
<html>
<other crap>
 
sure, i have a Snitz forum and an ASP counter.
could it be because of a script error in the script itself?
 
<%
If Request.ServerVariables("REMOTE_ADDR") = "212.199.177.179" Then
Response.Redirect "http://www.disney.com"
End If
%>
<html>
here comes your own (html) code.
 
The following codes have been tested to work on my server:

<%
If Request.ServerVariables("REMOTE_ADDR") = "*.*.*.*" Then
Response.Redirect "http://www.disney.com"
End If
%>
<html>
<other crap>


http://www.acidmist.com/pub/redirect.asp


Note that you can't use wildcards for ip address in asp. You could, alternatively, just compare the first two sets of the ip.
 
Back
Top