Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7458285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T13:25:40+00:00 2026-05-29T13:25:40+00:00

I am working on a c# program that retrieves information from a webservice and

  • 0

I am working on a c# program that retrieves information from a webservice and it uses an API key for authentication.

Currently I hardcoded this value in my program, but since I would like to keep the code in a public github repository I have to remove this by hand before committing it.

What is a more automated way of preventing me from accidentally committing with the API key still in the code?

I was thinking of creating a script that adds the secrets in using pre/post-build command execute options in Visual Studio. This way I never have to keep the API key in the code and it will be removed after building so committing it by accident will never happen.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T13:25:40+00:00Added an answer on May 29, 2026 at 1:25 pm

    Use a configuration file or the Windows Registry.

    I’d also recommend encrypting it, on Windows you can use the Data Protection API (DPAPI). .Net 2.0+ has a class call ProtectedData that’s very simple to use. This way if you do commit your configuration the key is still encrypted and will only work on your machine or even for your user on that machine depending on how you scope your data protection. You’ll want to make some way for people to enter in a key to use on their machines though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a program that uses PHP's internal array pointers to iterate along
I'm working on a program that will sort files based on extension I currently
I am working on a program that uses IE to display its help pages.
I'm working on a program from my C++ textbook, and this this the first
Working with a program that uses 16bytes 4v4 one byte matrices : unsigned char
I am currently working on a program in C# that allows our users to
I'm working on a (C++) program that has to process a lot of information
I am working on a program that needs to create a multiple temporary folders
I'm working on a program that processes many requests, none of them reaching more
I'm working on a program that searches entire drives for a given file. At

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.