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

  • SEARCH
  • Home
  • 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 7859187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:48:43+00:00 2026-06-02T21:48:43+00:00

I have program that connect to a SqlServer by predetermined username & password. Ex:

  • 0

I have program that connect to a SqlServer by predetermined username & password.
Ex:

static void Main(string[] args)
{
    string UserName, Password;
    UserName = "Name";
    Password = "Pass";

    SqlConnection conn = new SqlConnection("...");
}

How can I protect the password from decompilation?

  • 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-06-02T21:48:45+00:00Added an answer on June 2, 2026 at 9:48 pm

    Simply do not do that in the first place. The security system is designed to protect users from attackers who are trying to get the users to run bad code. It is not designed to protect your program from its users, which is what you are trying to do.

    Hard-coding a user name and password into an executable is a worst practice, for multiple reasons. First, because it grants access to the database to people who have your program, not to people who are authorized. Second, it means that if you ever need to change the user name or password, then you need to re-ship the program. Third, if the password does get out, and it only needs to get out once, what happens? You have no way to restrict access to just the attacker.

    A far better solution is to require that every user have their own account; make them type in the password. Or integrate the database access with some other identity-and-authorization scheme, like Windows authentication or whatever.

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

Sidebar

Related Questions

I have written an ActionScript client program that tries to connect to a local
I have a program that needs to connect to a server to gather some
I have a program that we use to connect our Magento store to our
I have made an App that can connect to a program that I am
I have a Java program that connects to a webserver using SSL/TLS, and sends
I have a java program that connects to a MySql database and it's working
I have a client program written in .NET 2.0, that connects to the web
I have program that sends a file to a printer using 'lpr' command. I
I have program that I want to test on clean Windows installation. For now
I have program that has a variable that should never change. However, somehow, it

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.