Click here to Skip to main content
15,892,072 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to find back links of different websites, so I need a class under System.Net, or System.Web;
to access all pages of the website and what method ton use here. Now I am using WebClient class and DownloadString method but this class not accessing all pages of the website. My code is

C#
using System;
using System.Net;
using System.Text.RegularExpresion;
{
 protected void btnELinks_Click(object sender, EventArgs e)
    {
        WebClient wc = new WebClient();
        string url = wc.DownloadString(txtELink.Text);
        string pattern = @"(<a.*?>.*?)";
        MatchCollection Mtcl;
        Mtcl =
            Regex.Matches(url, pattern);
        rblELinks.Items.Clear();
        lblLinkNo.Text = "";
        int a = 0;
        foreach (Match mt in Mtcl)
        {
            a++;
            rblELinks.Items.Add(mt.ToString());
        }
        lblLinkNo.Text = a.ToString();
       
    }
}
Posted
Updated 2-Jun-13 20:12pm
v3
Comments
Mohammed Hameed 3-Jun-13 1:43am    
I would recommend you to elaborate your question more to specify exactly what is you are looking for. Note (This is just to give you a hint if my guess is correct): 'Object' is the top most class in hierarchy and it is the ultimate base class of all classes in .NET.
Sergey Alexandrovich Kryukov 3-Jun-13 2:56am    
I agree, but we can guess what it could be. (Not that it should be done: it's generally better to wait for OP specifying things accurately, or not getting help otherwise...)
Anyway, I decided to answer this time, please see.
—SA
Sushil Mate 3-Jun-13 1:44am    
What exactly you want to achieve by accessing all pages?

1 solution

Why would you think that for each your idea someone already prepared a ready-to-use class for you? How about writing your own classes?

Anyway, the question makes no sense. If you think a bit more, you will understand that this is impossible in principle. However, using some Web scraping techniques you could solve some reasonable part of this "problem": you can get all the static pages which are directly or indirectly referenced from some start page:
http://en.wikipedia.org/wiki/Web_scraping[^].

For further detail, please see my past answers:
get specific data from web page[^],
How to get the data from another site[^].

—SA
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900