Tutorials
Resources
Forum
Interview
Jobs
Projects
Offshore Development
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Revenue Sharing
|
Talk to Us
|
My Profile
Sign In
Register
AdSense Revenue
Gifts
Active Members
Today
Sujit Kumar
(82)
tushqi
(79)
Satyanarayan SushilKumar Bajoria
(61)
Last 7 Days
Shivshanker Cheral
(931)
K.V.K
(791)
Ratheesh
(725)
more...
validate IP address
Posted Date: 08 May 2008 Resource Type:
Code Snippets
Category:
C# Syntax
Posted By:
narasimha
Member Level:
Gold
Rating:
Points
: 5
1.
public bool IsValidIP(string addr)
2.
{
3.
//create our match pattern
4.
string pattern = @"^([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\.
5.
([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$";
6.
//create our Regular Expression object
7.
Regex check = new Regex(pattern);
8.
//boolean variable to hold the status
9.
bool valid = false;
10.
//check to make sure an ip address was provided
11.
if (addr == "")
12.
{
13.
//no address provided so return false
14.
valid = false;
15.
}
16.
else
17.
{
18.
//address provided so use the IsMatch Method
19.
//of the Regular Expression object
20.
valid = check.IsMatch(addr, 0);
21.
}
22.
//return the results
23.
return valid;
24.
}
For more details, visit
http://www.eggheadcafe.com/community/aspnet/2/10034676/try-this.aspx
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
(No tags found.)
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
Data bind a Control to an Enum
Previous Resource:
captcha(UPDATED)
Return to Discussion Resource Index
Post New Resource
Category:
C# Syntax
Post resources and
earn money
!
Related Resources
How to convert HTMLinput file to Bytes
Check Internet connection present or not
Use of interface
How to use the MD5 and MD5CryptoServiceProvider Class to encode a string into a hash value
How to Empty all the text box in the form
Read
TATA Nano reviews
.
dotNet Slackers
BizTalk Adaptors
Web Design
Scripts
Are you waiting for engineering entrance result? Watch here for
engineering entrance results
.
accuconference
Contact Us
Privacy Policy
Terms Of Use