Having trouble with the following code. Not sure why it's not working. I'm trying to remove the periods (.) from IP addresses, so that I just have a 12 digit number. For example the IP address of 123.456.789.101 should be converted into 123456879101. I know the problem is in my regex statement. If I comment the regex line out, and simply use the "string ipNumber = ip;" then I get the IP address printed out as expected. However, if I use the regex line, then the output is blank or null.
public partial class _Default : System.Web.UI.Page
string userIP = HttpContext.Current.Request.UserHostAddress;
protected void Page_Load(object sender, EventArgs e)
lbAddress.Text = "IP-Address: " + hostAddress + " IP-Number: " + IPAddressConverter(userIP);
protected string IPAddressConverter(string ip)
string ipNumber = Regex.Replace(ip, ".", "");
//string ipNumber = ip;