Problema com DOWNLOADSTRING
No código abaixo consigo fazer o download do conteúdo HTML e avançar na navegação, porém, no último download ele volta para a página inicial, busquei na internet e aqui no fórum e não encontrei achar a solução. Alguma sugestão do que posso fazer para solucionar o problema?
using HtmlAgilityPack;
using System.Net;
namespace lehtml
{
class Program
{
static void Main(string[] args)
{
WebClient clt = new WebClient();
// 1º Download OK e avança
string ht = clt.DownloadString("https://issdigital.sorocaba.sp.gov.br/cene-sod/");
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(ht);
// 2º Download OK e avança
var no = doc.DocumentNode.SelectSingleNode("//input[@name='btn_Requerente']").GetAttributeValue("onclick", "").Trim();
var a = no.Substring(22, 25);
// 3º Download verifico que voltou para a página inicial
ht = clt.DownloadString("https://issdigital.sorocaba.sp.gov.br/cene-sod/" + a);
doc.LoadHtml(ht);
no = doc.DocumentNode.SelectSingleNode("//div[@class='menu_funcoes']/ul[@class='menu2']/li[3]/a").GetAttributeValue("href", "").Trim();
a = no.Substring(10, 38);
ht = clt.DownloadString("https://issdigital.sorocaba.sp.gov.br/cene-sod/" + a);
}
}
}
using HtmlAgilityPack;
using System.Net;
namespace lehtml
{
class Program
{
static void Main(string[] args)
{
WebClient clt = new WebClient();
// 1º Download OK e avança
string ht = clt.DownloadString("https://issdigital.sorocaba.sp.gov.br/cene-sod/");
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(ht);
// 2º Download OK e avança
var no = doc.DocumentNode.SelectSingleNode("//input[@name='btn_Requerente']").GetAttributeValue("onclick", "").Trim();
var a = no.Substring(22, 25);
// 3º Download verifico que voltou para a página inicial
ht = clt.DownloadString("https://issdigital.sorocaba.sp.gov.br/cene-sod/" + a);
doc.LoadHtml(ht);
no = doc.DocumentNode.SelectSingleNode("//div[@class='menu_funcoes']/ul[@class='menu2']/li[3]/a").GetAttributeValue("href", "").Trim();
a = no.Substring(10, 38);
ht = clt.DownloadString("https://issdigital.sorocaba.sp.gov.br/cene-sod/" + a);
}
}
}
Diego Silva
Curtidas 0