[HttpPost]
public ActionResult Index(string sehir)
{
string html;
Uri URL;
string xPath = "/html/body/table/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr/td/table[2]/tbody/tr[1]/td[2]/table/tbody/tr/td[2]/table[1]/tbody/tr[2]/td[2]";
string url = "http://195.216.232.22/product_price.asp?cityID=" + sehir;
URL = new Uri(url);
WebClient client = new WebClient();
client.Encoding = Encoding.UTF8;
html = client.DownloadString(URL);
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(html);
var deneme = doc.DocumentNode.SelectSingleNode(xPath).InnerText;
TempData["deneme"] = deneme;
return View();
}
deneme is coming null. HtmlAgilityPack.HtmlNode.SelectSingleNode(...), null exception
Aucun commentaire:
Enregistrer un commentaire