admin 10 months ago

How To Build Whats Is My IP With C#

If you need an introduction to C#, you are in the right place. C# is one of the most widely used programming languages today. It is one of the first languages that was developed for Microsoft’s .NET platform and has found its way into almost every other platform. In this post, I will be discussing how to build what is my ip address with csharp.

Lets Build The App

We start by launching visual studio and creating new project cretae nw visual studio project Click on create project a new window will open in the search box type console and select Console App (.net framework) and click on the Next Button a new windows will appear in the project name. you can type any name of your choice and click on create the project is created and it's time to start coding

We can not get our public ip address by ourself nstead we are going to use one of the website that offers our public adddress without any html or java script content and i found this website in stackoverflow called http://icanhazip.com/ that return the ip address

so in order to get the public ip we must download it from the website and to do that we are going to call

Webclient 

so first we create an instance of the class and call it webcall

 WebClient webcall = new WebClient();

next we call a method inside the webclient class called DownloadString and this method takes as perameter the url that we are going to download as html and return a string so we need to create a variable that will hold the response and we call public_ip

string public_ip = webcall.DownloadString("http://icanhazip.com");

next we print the result by typing

Console.WriteLine(public_ip);


and then we call the ReadKey to stop the app from closing after the excution of the code complete


Console.ReadKey();


Congratulation You found your public ip address

you can trim the response by removing the back line and the return line and you can do that by changing the code to

webcall.DownloadString("http://icanhazip.com").Replace("\r\n", "").Replace("\n", "");
0
512

External Links Can Help Your Traffic and Ranking

External links are links that direct users to websites other than your own. External links...

defaultuser.png
admin
2 months ago
video

Get More Youtube Subscribers

admin
admin
3 months ago
video

How to Screen Shot on Mac

admin
admin
10 months ago
video

How To Rank Youtube Video

admin
admin
9 months ago
video

The Difference Between ON Page and OFF Page SEO - The Import...

admin
admin
10 months ago