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=35but on two sites when i ask for this:
http://www.example.com/?p=35i 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.
精彩评论