Click here to Skip to main content
Click here to Skip to main content

Making Site Address Finder in C#

, 12 Aug 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Address Finder is a kind of program that helps the user to find new available URL of a website.

Introduction

What is address finder? Address finder is a kind of program that helps the user to find new available URL of a website. It can be useful when we want to change our current web URL or it expired and we want to show our new available web address to users. Other good usages of address finder is in some countries which websites become filter in that places and admins want to show users their new address.

Anyway, Address Finder algorithm is a good example for beginners practice.

Background

Generally, most of Address Finder programs algorithms are based on text file stream reading which are located in a host. By this, admin can write new address on that text file and new address will be shown to user who uses that address finder.

Some other advanced address finders are made from two parts. The first part is under user control and user can read address by that and the second part is under admin control and he can write new address to main source. Also this address finder is included with ads and some useful features.

Actually for offering address finders, admin must put address finder download link in a place where user downloads it and after that, the user can open it in order to see new available address.

Using the Code

I subdivide the way of creating Address Finder to some basic steps which can do them easily. Also, you must have noticed that I am talking about the easiest way of making Address Finder and in other methods, you can do something else. Now, it is time for coding!

  1. First Step: At first, we need to create a text file with Notepad and then add URL address (which we want to show as new address to user) to it. For example, I create link.txt and then type www.filmbinha.ir to it.
  2. Second Step: Now you must upload that text file to a trusted host. In this example, my uploaded link is http://adyab.sourcenevis.ir/Adress.txt.
  3. Third Step: Now, in our C# solution, we must add a button and code in order to read that text file which is now uploaded to a specific host. My code in button click event:
    try 
    { 
       System.Net.WebClient WebClient = new System.Net.WebClient(); 
       WebClient.DownloadFile("http://adyab.sourcenevis.ir/Adress.txt", @"link.txt"); 
       StreamReader reader = new StreamReader(@"link.txt"); 
       string URLvalue = reader.ReadToEnd(); 
       reader.Close();
       reader.Dispose(); 
       textBox1.Text = URLvalue; 
    }
    catch { }      

    Code Explanation: In this method, we start reading our text file on internet host by using a StreamReader. It is designed for character input in a particular encoding, whereas the Stream class is designed for byte input and output. We can use StreamReader for reading lines of information from a standard text file. More

    Also, don't forget that StreamReader class needs System.IO using.

  4. Last Step: All done successfully. Also, you can add a button for going to detected URL like below code:
    if (textBox1.Text != "")
                {
                    try
                    {
                        System.Diagnostics.Process.Start(textBox1.Text);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error", 
                          MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("At first please push 'Search' button please.");
                } 

Now, your Address Finder is finished and you can work on its graphic. Mine & my friend's Address Finder are like below:

Also, you can download this example source code from links which are placed at the top of the page.


Usage

As I mentioned before, Address Finders are good programs (especially in countries with site filtering policy) for finding new available URL of website and also its algorithm can be informative for beginner programmers. For example, in Iran, all of Music and Movie download centers use address finder to show their new address to users.

Article in other Languages

Iranian members or readers of CodeProject can download the Persian video tutorial of this tip by clicking here and also they can read the Persian version of this tip from this link.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Amir Nasrollahi
CEO
Iran (Islamic Republic Of) Iran (Islamic Republic Of)
- Founder & CEO at Artificial Intelligence Developers - (AID)
- CSM Technology Founder
- Research and Development in the field of "Cloud Computing" and various topics of cloud science, artificial intelligence, speech and image processing, any platform projects design and construction.

Comments and Discussions

 
Question[My vote of 1] Lang?! Pinmemberuser998763513-Aug-13 7:18 
AnswerRe: [My vote of 1] Lang?! PinprofessionalAmir Mohammad Nasrollahi13-Aug-13 8:12 
GeneralRe: [My vote of 1] Lang?! PinprofessionalDavid H. Wright14-Aug-13 1:56 
AnswerRe: [My vote of 1] Lang?! PinprofessionalAmir Mohammad Nasrollahi14-Aug-13 4:38 
GeneralMy vote of 5 Pinprofessionalketan italiya12-Aug-13 22:44 
GeneralRe: My vote of 5 PinprofessionalAmir Mohammad Nasrollahi13-Aug-13 0:05 
GeneralMy vote of 5 PinprofessionalReza Khan Mohammad12-Aug-13 11:49 
GeneralRe: My vote of 5 [modified] PinprofessionalAmir Mohammad Nasrollahi12-Aug-13 11:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 12 Aug 2013
Article Copyright 2013 by Amir Nasrollahi
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid