0

I am using entity framework in my project and its created connection string in web.config, I want to encrypt ip, username and password because it can be easily accessible. how can i encrypt these credential ?

Kapil Rajput
  • 11,429
  • 9
  • 50
  • 65
Dhananjay Singh
  • 161
  • 1
  • 12
  • 2
    If your web.config is easily accessible, you've got bigger problems. – Rob Apr 06 '17 at 05:46
  • it's not about hackers only ...if someone copy my code then he can easily delete my database or tables by seeing credentials from web.config ..so is there any way to encrypt this? – Dhananjay Singh Apr 06 '17 at 05:53

1 Answers1

0

You can use the aspnet_regiis command line tool to achieve this.

However, I would advise that you seek to do this as part of your build process somehow. This way you retain the unencrypted values in your source control, but the encrypted values in deployed environments.

Reddog
  • 15,219
  • 3
  • 51
  • 63
  • Thanks @Reddog for the reply.,,i downloaded the zip file of code which given in the link and try to run it...it is giving error "Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: The RSA key container could not be opened." after this i took help form this link " http://stackoverflow.com/questions/16124389/failed-to-decrypt-using-provider-rsaprotectedconfigurationprovider " ..But unfortunately its not working and still i am getting same error . – Dhananjay Singh Apr 06 '17 at 06:17