Bytes Expert Newtork: Connect with experts in IT / Business | Expert Topics



Search


Go Back   Programmers Resource > Code Section > ASP Tips & Code Snippets
User Name
Password


 
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 04-30-2005, 12:01 PM
purplepyro's Avatar
purplepyro purplepyro is offline
Relational DB Theorist
 
Join Date: Apr 2005
Posts: 33
Function to Check Whether IP is Private Address

Code:
Function IsPrivateIp(sIpAddress) ' Given IP string, checks whether it is a private address ' DOES NOT CHECK FOR VALID IP FORM ' Use IsValidIp to check validity ' Checks for STRICT private addresses; ' does not guess about common misuse such as 192.0 nets Dim aTmp IsPrivateIp = False aTmp = split(sIpAddress,".") ' Is it a class 10 network? If aTmp(0) = 10 Then IsPrivateIp = True ' If not a 10, is it a 172 private address? If aTmp(0) = 172 Then If ( aTmp(1)>15 ) And ( aTmp(1)<32 ) Then IsPrivateIp = True End If ' If neither of the above, is it a 192.168 IP? If ( aTmp(0)=192 ) And ( aTmp(1)=168 ) Then IsPrivateIp = True End Function
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -5. The time now is 06:48 AM.



Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
All content Copyright ©1999 - 2010, Programmers Resource, unless otherwise noted.