Search code examples
c#httpwebclient

The remote server returned an error: (412) Precondition Failed


I see the error 412 Precondition failed with the below code. It used to work until 1st of April 2021. It started failing from 2nd April 2021.

var response = new WebClient().DownloadString("http://www.dce.com.cn");

Please can someone help me with this?

Thanks in advance


Solution

  • It's a bug in the server. A 412 on a request with no conditional request header fields is incorrect.