defaultProxy settings in an Add-In

1318
2
Jump to solution
11-29-2017 03:01 AM
GISMountains
New Contributor III

Hello

I would like to implement in an "ArcGIS Pro Module Add-in" some request to rest-api which is different endpoint then ESRI-Servers.
This works well if the ArcGIS Pro with the addin is connected to internet direct. But if it is behind a Proxy it does not work with the Exception:
"System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required."

In a separate .Net C# WPF Application I set the app.config with following parameters:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true"/>
</system.net>
</configuration>

--> This works!

I tried the same in the "ArcGIS Pro Module Add-in" with a file in the project "app.config". After compilation, the content is inside a file beside the dll with the name "demo.dll.config" and the expected content:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.net>
<defaultProxy enabled="true" useDefaultCredentials="true"/>
</system.net>
</configuration>

How can I configure the DefaultProxy I the Add-In for Rest-Api-Calls?

Thanks in advance for any help.

0 Kudos
1 Solution
2 Replies
GISMountains
New Contributor III

Thank you very much charles!

It workes with the following line 

System.Net.WebRequest.DefaultWebProxy.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

0 Kudos