26 Kasım 2013 Salı

The remote server returned an error: (500) Internal Server Error (Webclient)

Solution this ;

You must add this code :
client.Headers.Add("user-agent","Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101 Firefox/4.0");

Uri url = new Uri(urlAddress);
            WebClient client = new WebClient();
            client.Headers.Add("user-agent","Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101 Firefox/4.0");
            client.Encoding = System.Text.Encoding.UTF8;
            string html = client.DownloadString(url);
            return html;
Share:

0 yorum:

Yorum Gönder

Blog Arşivi