What would be the fastest way to get the numerical format (NOT THE STRING FORMAT) of the client?
string format : 223.255.254.0
numeric format : 3758095872
I can postcompute this by some code like
static public uint IPAddressToLong(string ipAddress)
{
var oIP = IPAddress.Parse(ipAddress);
var byteIP = oIP.GetAddressBytes();
var ip = (uint)byteIP[0] << 24;
ip += (uint)byteIP[1] << 16;
ip += (uint)byteIP[2] << 8;
ip += byteIP[3];
return ip;
}
based on the Request.UserHostAddress string but I was hoping that IIS or ASP.NET precomputes this and it's somewhere hidden in the HttpContext.
Am I wrong?