I am using a custom API which performs a look up for an IP and provides the detailed information like the address, country, etc. I have the URL of my API where I have to replace the “HOST” parameter with the API entered in the Textbox from my ASP.NET page.
So first I should store the textbox data (which contains the IP) in a string.
Then I should replace this data with the “HOST” parameter in my API URL. Let the URL perform the lookup and retrieve the information it finds (city, country, ISP, etc.) to show it in my ASP.NET page.
How would it be possible that instead of passing one IP address, pass multiple IP adresses from a textbox to the URL, get their corresponding data and show them on my page?
Any suggestions or thoughts?
Thanks.
You could use a Regex for getting the IPs. If you used the SingleLine option it wouldn’t matter how you separated the IP addresses either, you could separate them by a space or anything really using the following (C#):
You can test this at http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx I tried it with the following test data (not exhaustive but it demonstrates the point):
I put some spaces in between lines as well just to make sure, but it doesn’t show that in the quote.