How to Set Proxy in DSS REST API using CSharp?

Options

We are using EventContext.Extract to extract data but getting random error and connection breaks with error as "An error occurred while sending the request". Could anyone please help me in setting up proxy.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    You can use this code to set a proxy to ExtractionContexts.

    using System.Net;
    ...
    ExtractionsContext extractionsContext = new ExtractionsContext(dssUri, dssUserName.Value, dssPassword.Value);

    WebProxy proxy = new WebProxy("http://<host>:<port>/", true);
    extractionsContext.Options.Proxy = proxy;
    extractionsContext.Options.UseProxy = true;