Ok, I'm new to this encrypt/decrypt thing, actually never have used it before. But now I got a job
and the previous programmer encrypted the <connectionStrings> sector on the web.config file, both on testing and live servers. I developed a new site and it does have new connections. This project is part of a solution that is under the same web.config where the encrypted connectionStrings are (I hope I'm being clear). Not knowing anything about the encrypting thing I simply put the site on the server when I try to open a page that calls for my connection, the following shows:
Configuration Error
Description: An
error occurred during the processing of a configuration file required
to service this request. Please review the specific error details below
and modify your configuration file appropriately.
Parser Error Message: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data.
Source Error:
Line 3: <appSettings/> Line 4: <connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider"> Line 5: <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" Line 6: xmlns="http://www.w3.org/2001/04/xmlenc#"> Line 7: <EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" /> |
So, I read and read about the subject, turns out that I need to decrypt the web.config, add my connection and encrypt again, right? So I go to the server, command prompt and I tried running "aspnet_regiis - pdf "connectionStrings" "path to my site" ". A message "start to decrypt" shows but a little latter the same error message shows in the command prompt: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data.
I don't know what might be causing this...I read about containers and keys...but to be honest I still don't know how they apply. I can't mess up with the encrypted section because there are connections there other applications are using.
I need ideas of what I can do to decrypt that. I also read that encryption is machine related, the previous programmer might have copied web.config from the live server to the testing, that would give me an error, right?
If I cant decrypt at all, what I'm thinking is, is it possible to add new connections outside <connectionStrings>? Like, a custom section or something. I found out that I can use <location> to add another <connectionStrings> but, I don't know, yet, how to implement it. The second possible solution, not a very good one, is create the connection in run-time, on the code behind.
Please, any light?