c# - How to get data from web page? -


I want to get data from the page and put it in my mssql database. How can I read this data with ASP.NET C #? SehisID is the value of 1 to 81.

Edit: My code is below.

 for  (int i = 1; i & lt; = 81; i ++) {HttpWebRequest rqst = (HttpWebRequest) WebRequest.Create ("http://www.milliyet.com .tr / secim2009 / api / belediyelist.ashx? Sehirid = "+ i); Rqst.method = "post"; Rqst.ContentType = "text / xml"; Rqst.ContentLength = 0; Rqst.Timeout = 3000; HttpWebResponse rspns = (HttpWebResponse) rqst.GetResponse (); Form1.InnerHtml + = rspns.ToString () + "& lt; br & gt;"; }  

Webclient is an easy way to get the string From web page:

  Webclient client = new webclient (); String downloaded string = client DownloadString ("http://www.milliyet.com.tr/Secim2009/api/belediyelist.ashx?sehirid=81");  

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -