IF Statement - HELP !!

J

Jerry Yang

IPADDRESS = Request.ServerVariables("remote_addr")
response.write IPADDRESS

Can someone advise how I do this

If IPADDRESS is not one of 3 addrress then response.redirect
"notallowed.html"

I had thought

if IPADDRESS <> "xxx.xxx.xxx.xxx" OR IPADDRESS <> "yyy.yyy.yyy.yyy" OR
IPADDRESS "aaa.aaa.aaa.aaa" then response.redirect "notallowed.html"

but that fails !!

Help Thanks
 
D

daddywhite

if IPADDRESS <> "xxx.xxx.xxx.xxx" AND IPADDRESS <> "yyy.yyy.yyy.yyy"
AND
IPADDRESS "aaa.aaa.aaa.aaa" then response.redirect "notallowed.html"

Use "AND" instead of "OR"
 
A

Anthony Jones

Jerry Yang said:
IPADDRESS = Request.ServerVariables("remote_addr")
response.write IPADDRESS

Can someone advise how I do this

If IPADDRESS is not one of 3 addrress then response.redirect
"notallowed.html"

I had thought

if IPADDRESS <> "xxx.xxx.xxx.xxx" OR IPADDRESS <> "yyy.yyy.yyy.yyy" OR
IPADDRESS "aaa.aaa.aaa.aaa" then response.redirect "notallowed.html"

but that fails !!
Fails In what way. I take it the missing <> in the third clause is simply a
typo?

Had you considered simply using the IIS manager and adding the IP address
restrictions to the file in the properties dialog?
 
E

Evertjan.

Anthony Jones wrote on 07 sep 2008 in
microsoft.public.inetserver.asp.general:
.
Fails In what way. I take it the missing <> in the third clause is
simply a typo?

Had you considered simply using the IIS manager and adding the IP
address restrictions to the file in the properties dialog?

IPADDRESS <> "a" OR IPADDRESS <> "b"

This is always true,
as IPADDRESS cannot be two different things/strings at the same time.

Try AND.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top