Request.UserHostAddress

T

tma

I am creating code that makes decisions based on the result of the
Request.UserHostAddress. Is there a way I can search on /CIDR or range of IP
addresses without specifying an exact search string, i.e. one string for
each IP address? You can imagine why I don't want to have to create a
CASE/ELSE for this scenario...

I'm open to any suggestions.
 
J

John Saunders

tma said:
I am creating code that makes decisions based on the result of the
Request.UserHostAddress. Is there a way I can search on /CIDR or range of
IP
addresses without specifying an exact search string, i.e. one string for
each IP address? You can imagine why I don't want to have to create a
CASE/ELSE for this scenario...

I'm open to any suggestions.

I presume you're guaranteed what the IP addresses are, and that they won't
ever change or be placed behind a NAT box or something that will change the
IP addresses? Or that the subnet setup won't change?

Why not identify machines with something like an X.509 certificate, which is
_meant_ to be identifying? IP addresses aren't actually meant for that
purpose.

John Saunders
 
T

tma

Actually, the IP addresses are from "people" who hit my website. Spiders for
example. So while the address space is fairly constant, it still needs to be
a range of addresses to test for.

Any thoughts?
 
W

WJ

Impossible mission! How can you tell if it is fake IP or Ip generated by
dhcp ? It makes sense for intranet but not internet.

John
 
T

tma

I don't need to know if the IP address is "real", only that it falls within
a specified subnet.
 
E

Eliahu

Maybe what I immediately think of is trivial, but Request.UserHostAddress
returns a string, so can you use regular expression to identify the subnet?
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top