You can do in different ways:
you can :
1. Use string.Substring; to get the idex of first dot you can use
string.IndexOf
2. You can split the string on dots - string.Split('.') and get an array of
IP parts.
3. You can use string.StartsWith("22.") if the "22." is the only option.
--
HTH
Stoitcho Goutsev (100)
"so*******@hotmail.com" <so*****************@discussions.microsoft.com>
wrote in message news:4C**********************************@microsof t.com...
I am attempting to collect the user's IP address from a Web App. I then
need
to verify the address is not an 'internal' user. I need to compare the
left 3
characters of the IP address with a constant. I know I have done this with
the left function in VB. I can't seem to locate a similar function in C#.
Can
someone assist?
if (Session["UserIP"].ToString() == "22.")