ODataDataProvider and Operating System Proxy Settings

Problem

If you run the ODataDataProvider on a system with individual proxy settings, you may receive an error message of the following type:

The remote server has returned an error: (407) Proxy authentication required

Reason is that the correct proxy server is used for the queries, but the default settings of the .NET Framework do not use the standard credentials. Therefore the query via the proxy server is not possible because it is not correctly authenticated.

Solution

There are two possible solutions. First, you can add the following entry to app.config:

<system.net>
  <defaultProxy useDefaultCredentials="true" />
</system.net>

Alternatively, you can also make the setting in your code by issuing the following call before the ODataDataProvider constructor:

WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultNetworkCredentials;

You can find further hints here on StackOverflow.