开发者

how do i get the freindly url?

i writen this code im using it for checking if a certin url is found on a web page

    private void checkUrls (){

        WebClient client;

        for (int i = 0; i < Convert.ToInt32(txtnum.Text); i++) {
            try
            {
                string Url = "http://www." + txtUrl.Text + i.T开发者_运维问答oString();

                client = new WebClient();
                string result = client.DownloadString(Url);
                if (result.Contains(txtsearch.Text))
                   MessageBox.Show(Url);

            }
            catch (Exception ex) { }

the base url look like this:

http://www.example.com/?p=35

but on two sites when i ask for this:

http://www.example.com/?p=35

i get redirected to somthing like this

http://www.example.com/some_categoery/postitle/

i need to search the site in the first manner but to download the content of the freindly url

can anyone show me the right direction to do so ?

i checking website where i do no know how many pages there on the site


You could try the HtmlAgilityPack to get all the anchor tags and check the href attribute for the value you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜