Hi,
I have to restrict access to a site based on IP address. While I have
been able to this successfully with code in the Global.aspx file, some
if the IP address are not single IP addresses but rather ranges.
If I know the network ID and the subnet mask, how can I check if a
given IP address falls within that range?
Thanks for any help,
Richard 4 2048
You perform AND with the netmask to the IP you want to check, then compare
the result with the network IP of the netmask, if they're the same, then the
IP you want to check falls in range, otherwise, proceed to next network IP +
netmask pair...
<ri************ *@gmail.com>
???????:11***** *************** **@f14g2000cwb. googlegroups.co m... Hi,
I have to restrict access to a site based on IP address. While I have been able to this successfully with code in the Global.aspx file, some if the IP address are not single IP addresses but rather ranges.
If I know the network ID and the subnet mask, how can I check if a given IP address falls within that range?
Thanks for any help, Richard
Download and use Softperfect's free network scanner : http://www.softperfect.com/products/...canner/manual/
It will help you understand these concepts a lot
easier than working on a theoretical basis.
In particular , check the "Options" - "Auto detect Local IP range" menu.
Download it at : http://www.softperfect.com/download/
OTOH, you *can* ban by IP range in global.asax,
if you use the Left function in VB.NET.
i.e., if you are interested in banning IPs from 192.168.0.0 to 198.168.0.255
you'd check the UserHostAddress and use the Left function
to determine whether the leftmost 9 characters are 192.168.0.
That would identify the 256 IP addtesses from 192.168.0.0 to 198.168.0.255
The same principle applies to any IP range.
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
<ri************ *@gmail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hi,
I have to restrict access to a site based on IP address. While I have been able to this successfully with code in the Global.aspx file, some if the IP address are not single IP addresses but rather ranges.
If I know the network ID and the subnet mask, how can I check if a given IP address falls within that range?
Thanks for any help, Richard
Oh ban by Left()... Then it'll left tiny holes if the netmasks are
128/64/32/16 ones.. :P
"Juan T. Llibre" <no***********@ nowhere.com> ¼¶¼g©ó¶l¥ó·s»D: e0************* *@TK2MSFTNGP14. phx.gbl... Download and use Softperfect's free network scanner :
http://www.softperfect.com/products/...canner/manual/
It will help you understand these concepts a lot easier than working on a theoretical basis.
In particular , check the "Options" - "Auto detect Local IP range" menu.
Download it at : http://www.softperfect.com/download/
OTOH, you *can* ban by IP range in global.asax, if you use the Left function in VB.NET.
i.e., if you are interested in banning IPs from 192.168.0.0 to 198.168.0.255
you'd check the UserHostAddress and use the Left function to determine whether the leftmost 9 characters are 192.168.0.
That would identify the 256 IP addtesses from 192.168.0.0 to 198.168.0.255
The same principle applies to any IP range. Juan T. Llibre, ASP.NET MVP ASP.NET FAQ : http://asp.net.do/faq/ ASPNETFAQ.COM : http://www.aspnetfaq.com/ Foros de ASP.NET en Español : http://asp.net.do/foros/ =============== =============== ======== <ri************ *@gmail.com> wrote in message news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hi,
I have to restrict access to a site based on IP address. While I have been able to this successfully with code in the Global.aspx file, some if the IP address are not single IP addresses but rather ranges.
If I know the network ID and the subnet mask, how can I check if a given IP address falls within that range?
Thanks for any help, Richard
Well, that *was* an alternate choice, not a primary recommendation.
;-)
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
ASPNETFAQ.COM : http://www.aspnetfaq.com/
Foros de ASP.NET en Español : http://asp.net.do/foros/
=============== =============== ========
"Lau Lei Cheong" <le****@yehoo.c om.hk> wrote in message
news:um******** *****@TK2MSFTNG P14.phx.gbl... Oh ban by Left()... Then it'll left tiny holes if the netmasks are 128/64/32/16 ones.. :P
"Juan T. Llibre" <no***********@ nowhere.com> ¼¶¼g©ó¶l¥ó·s»D: e0************* *@TK2MSFTNGP14. phx.gbl... Download and use Softperfect's free network scanner :
http://www.softperfect.com/products/...canner/manual/
It will help you understand these concepts a lot easier than working on a theoretical basis.
In particular , check the "Options" - "Auto detect Local IP range" menu.
Download it at : http://www.softperfect.com/download/
OTOH, you *can* ban by IP range in global.asax, if you use the Left function in VB.NET.
i.e., if you are interested in banning IPs from 192.168.0.0 to 198.168.0.255
you'd check the UserHostAddress and use the Left function to determine whether the leftmost 9 characters are 192.168.0.
That would identify the 256 IP addtesses from 192.168.0.0 to 198.168.0.255
The same principle applies to any IP range. Juan T. Llibre, ASP.NET MVP ASP.NET FAQ : http://asp.net.do/faq/ ASPNETFAQ.COM : http://www.aspnetfaq.com/ Foros de ASP.NET en Español : http://asp.net.do/foros/ =============== =============== ======== <ri************ *@gmail.com> wrote in message news:11******** **************@ f14g2000cwb.goo glegroups.com.. . Hi,
I have to restrict access to a site based on IP address. While I have been able to this successfully with code in the Global.aspx file, some if the IP address are not single IP addresses but rather ranges.
If I know the network ID and the subnet mask, how can I check if a given IP address falls within that range?
Thanks for any help, Richard
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: gc |
last post by:
Hi,
What is the purpose of the restrict keyword?
gc
|
by: tweak |
last post by:
Can someone give me a short example as how to best use this keyword in
your code?
This is my understanding: by definition restrict sounds like it is
suppose to restrict access to memory location(s) pointed to, so that
only one declared pointer can store that address and access the data in
those memory blocks, where I the data in those location(s) can be changed.
Is that a correct understanding?
|
by: ccdrbrg |
last post by:
I'm having trouble understanding restrict.
Can someone provide a layman's explanation.
Chad
|
by: pemo |
last post by:
In Harbison and Steele's book, they say that using 'restrict' allows
functions like memcpy() to be prototyped like this:
void * memcpy(void * restrict s1, const void * restrict s2, size_t n);
But this seems a mite dangerous to me ... a restricted pointer ... is
*assumed* to be the only to access an object.
So, mightn't using such a prototype subtly imply that the compiler
will *actively check* that s1 and s2 do not point to the same
|
by: pemo |
last post by:
If you were to compile/run the code below, and get the result '30', I'd be
very interested to know what compiler you're using - and its optimisation
settings
#include <stdio.h>
int test(int * a, int * b)
{
*a = 5;
*b = 6;
| |
by: Me |
last post by:
I'm trying to wrap my head around the wording but from what I think the
standard says:
1. it's impossible to swap a restrict pointer with another pointer,
i.e.
int a = 1, b = 2;
int * restrict ap = &a;
int * restrict bp = &b;
|
by: Niu Xiao |
last post by:
I see a lot of use in function declarations, such as
size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE*
restrict fp);
but what does the keyword 'restrict' mean? there is no definition found
in K&R 2nd.
|
by: Frederick Gotham |
last post by:
I'm going to be using an acronym a lot in this post:
IINM = If I'm not mistaken
Let's say we've got translation units which are going to be compiled to
object files, and that these object files will be supplied to people to link
with their own projects. Here's a sample function in one of the object files:
void Func(int const *const p)
{
|
by: rainy6144 |
last post by:
Does the following code have defined behavior?
double *new_array(unsigned n)
{
double *p = malloc(n * sizeof(double));
unsigned i;
for (i = 0; i < n; i++) p = 0.0;
return p;
}
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |