//Rextester.Program.Main is the entry point for your code. Don't change it.
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
// Create a request for the URL.
WebRequest request = WebRequest.Create (
//@"http://whatismyipaddress.com/ip/31.207.0.99"
"http://ipv4bot.whatismyipaddress.com"
);
// If required by the server, set the credentials.
// Get the response.
WebResponse response = request.GetResponse ();
// Display the status.
Console.WriteLine (((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd ();
// Display the content.
Console.WriteLine (responseFromServer);
// Clean up the streams and the response.
reader.Close ();
response.Close ();
}
}
}
//Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5
using System;
using System.IO;
using System.Net;
using System.Text;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
// Create a request for the URL.
WebRequest request = WebRequest.Create (
//@"http://whatismyipaddress.com/ip/31.207.0.99"
"http://ipv4bot.whatismyipaddress.com"
);
// If required by the server, set the credentials.
// Get the response.
WebResponse response = request.GetResponse ();
// Display the status.
Console.WriteLine (((HttpWebResponse)response).StatusDescription);
// Get the stream containing content returned by the server.
Stream dataStream = response.GetResponseStream ();
// Open the stream using a StreamReader for easy access.
StreamReader reader = new StreamReader (dataStream);
// Read the content.
string responseFromServer = reader.ReadToEnd ();
// Display the content.
Console.WriteLine (responseFromServer);
// Clean up the streams and the response.
reader.Close ();
response.Close ();
}
}
}