Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > IF Statement - HELP !!

Reply
Thread Tools

IF Statement - HELP !!

 
 
Jerry Yang
Guest
Posts: n/a
 
      09-07-2008
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

 
Reply With Quote
 
 
 
 
daddywhite
Guest
Posts: n/a
 
      09-07-2008
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"
 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      09-07-2008
"Jerry Yang" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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?


--
Anthony Jones - MVP ASP/ASP.NET

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      09-07-2008
Anthony Jones wrote on 07 sep 2008 in
microsoft.public.inetserver.asp.general:

> "Jerry Yang" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)..
> .
>> 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?


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

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

Try AND.


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

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
if statement that, when false, skips first statement in its block, executes second? Jay McGavren Java 11 01-16-2006 05:49 PM
How do I do a conditional statement in a constant statement? tkvhdl@gmail.com VHDL 3 12-16-2005 06:13 PM
Which of switch statement and if-else statement takes less time to execute? swaroophr@gmail.com C Programming 21 08-02-2005 09:24 AM
exec "statement" VS. exec "statement in globals(), locals() Ted Python 1 07-22-2004 08:51 AM
exec "statement" VS. exec "statement" in globals(), locals() tedsuzman Python 2 07-21-2004 08:41 PM



Advertisments