Webclient - The remote server returned an error: (403) Forbidden
Using downloadstring of webclient returns an error as stated by the post title. The solution was to add user agent header to the webclient headers. The value of user agent can be found in the mozilla firebug.
Solution:
Solution:
string URL = string.Format(your_url); newWebClient.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101 Firefox/4.0"); string pageSource = newWebClient.DownloadString(URL); pageSource = System.Web.HttpUtility.HtmlDecode(pageSource);
Comments
Post a Comment