WebClient request returns empty string

In my program, I need to get the contents of my site, however returning the DownloadString method of the webclient object returns null, however the most intriguing is the absence of an exception. the status code is 200, the request is executed perfectly, but the url returns an empty string.

WebClient wc = new WebClient(); String teste = wc.DownloadString("http://www.wiplay.com.br"); 

My website is http://www.wiplay.com.br

+6
source share
1 answer

Your site seems to require the user agent header to be configured to respond.

Add the DownloadString method before the next call:

 wc.Headers.Add(HttpRequestHeader.UserAgent, "your useragent string"); 
+3
source

All Articles