Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

C# API connection using proxy

Solved1.83K views28th February 2023proxy
11
David Joseph [SLC] [DevOps Enabler]417 27th February 2023 0 Comments

From a Dataminer installed on an internal network at a customer we need to do an API call to a cloud application. There is no direct access from this server, so a proxy server has been set up in the middle to make the communication possible. This has been setup as a default proxy on the windows machine. When testing this API access via the browser or via postman from this machine, the API call works (by passing via the configured proxy), no need to configure anything on browser level or in Postman. However when doing the call from automation using HttpClient the proxy is not used. The only way to make it work it seems is to hardcoded the proxy in the automation script as follows:

Is there another way to make sure the httpClient use the system configured proxy without hardcoding this using a proxy in the script ?

David Joseph [SLC] [DevOps Enabler] Selected answer as best 28th February 2023

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
17
Jeroen Neyt [SLC] [DevOps Advocate]2.35K Posted 27th February 2023 0 Comments

The reason why this works out of the box in Postman and the browser is because those processes will be running as the user who has the proxy settings configured in Windows.

SLAutomation (and as a result all your automation scripts) run as the  NT_AUTHORITY/SYSTEM user. One of the ways to avoid having to configure the proxy server details in your script would be to configure them on that user in Windows similar like how it was already configured on that other user.

How to set up a proxy for Local System account at the machine level describes how you can easily set this up.

After having configured those settings, HttpClient will use those by default, so you can just do the following:

var client = new HttpClient();

var response = client.GetAsync(“https://community.dataminer.services”);

And the request will be sent through the proxy.

David Joseph [SLC] [DevOps Enabler] Selected answer as best 28th February 2023
2
Sebastián Cuéllar [SLC] [DevOps Advocate]134 Posted 27th February 2023 0 Comments

Hello David,

I think to build an interactive automation script could be usefull in this case. You could ask for the proxy address the very first time the automation is executed, save that value and then include a flag or something to the automation knows that the proxy parameter is already set and it just has to stablish the connection.
If you want to go deeper into this, you can check the Help in your DataMiner Cube App and then go to Advanced DataMiner Modules > DMS Automation > Using CSharp code in Automation scripts > Building interactive Automation scripts with CSharp.
I really have not had the oportunity to implement one of these interactive automations but I hope this could be usefull helping you to solve you problem.

Sebastián Cuéllar [SLC] [DevOps Advocate] Answered question 27th February 2023
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs