Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / General ASP Topics / September 2008



Tip: Looking for answers? Try searching our database.

IF Statement - HELP !!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry Yang - 07 Sep 2008 17:21 GMT
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
daddywhite - 07 Sep 2008 17:27 GMT
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"
Anthony Jones - 07 Sep 2008 17:30 GMT
> IPADDRESS = Request.ServerVariables("remote_addr")
> response.write IPADDRESS
[quoted text clipped - 10 lines]
>
> 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?

Signature

Anthony Jones - MVP ASP/ASP.NET

Evertjan. - 07 Sep 2008 20:52 GMT
Anthony Jones wrote on 07 sep 2008 in
microsoft.public.inetserver.asp.general:

> .
>> IPADDRESS = Request.ServerVariables("remote_addr")
[quoted text clipped - 18 lines]
> 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.

Signature

Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.