Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Web.config Encryption and Decryption

Web.config Encryption and Decryption

Scheduled Pinned Locked Moved ASP.NET
questionsecuritycomsysadminhosting
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    Otekpo Emmanuel
    wrote on last edited by
    #1

    Hi there, I want to encrypt my site web.config file for security purposes and why searching codeproject for this topic, I found this useful link https://www.codeproject.com/Tips/795135/Encrypt-ConnectionString-in-Web-Config I followed the steps and was able to encrypt the connection strings on my local system. Now, I copied the web.config file to my host server root directory. Then on loading the site, I got this error-: Parser Error Message: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data. Then I tried searching the net and codeproject for solution but none was found by me pointing to error why uploaded to server. Maybe am not using the right keywords! However, I came across a link that suggested I should change Or Which I did but no luck. But I believe someone here on codeproject has the solution. So my question is, how can I make this to work after uploading to server? Note: Am using shared hosting for now so I don't have admin rights to do anything on the server. Thanks in advance!

    Richard DeemingR O 2 Replies Last reply
    0
    • O Otekpo Emmanuel

      Hi there, I want to encrypt my site web.config file for security purposes and why searching codeproject for this topic, I found this useful link https://www.codeproject.com/Tips/795135/Encrypt-ConnectionString-in-Web-Config I followed the steps and was able to encrypt the connection strings on my local system. Now, I copied the web.config file to my host server root directory. Then on loading the site, I got this error-: Parser Error Message: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data. Then I tried searching the net and codeproject for solution but none was found by me pointing to error why uploaded to server. Maybe am not using the right keywords! However, I came across a link that suggested I should change Or Which I did but no luck. But I believe someone here on codeproject has the solution. So my question is, how can I make this to work after uploading to server? Note: Am using shared hosting for now so I don't have admin rights to do anything on the server. Thanks in advance!

      Richard DeemingR Online
      Richard DeemingR Online
      Richard Deeming
      wrote on last edited by
      #2

      Did you read the article you've linked to?

      Quote:

      ... if you encrypt your Config file, then your machine would store your keys and if you copy the Config file to a different system and try to decrypt it, then you might get an error.

      The encryption keys are stored on the machine where the file was encrypted. You need to upload a decrypted version of the config file and run the encryption commands on the server where you application will be running. You can't encrypt on one computer and copy the encrypted file to another computer.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      O 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Did you read the article you've linked to?

        Quote:

        ... if you encrypt your Config file, then your machine would store your keys and if you copy the Config file to a different system and try to decrypt it, then you might get an error.

        The encryption keys are stored on the machine where the file was encrypted. You need to upload a decrypted version of the config file and run the encryption commands on the server where you application will be running. You can't encrypt on one computer and copy the encrypted file to another computer.


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        O Offline
        O Offline
        Otekpo Emmanuel
        wrote on last edited by
        #3

        Ok thanks. Just as I stated on the original, I don't have access to command prompt on the server cos is a shared host. How about if I create it using code behind on the server, will this error persist? Once again, thanks for your help!

        Richard DeemingR 1 Reply Last reply
        0
        • O Otekpo Emmanuel

          Ok thanks. Just as I stated on the original, I don't have access to command prompt on the server cos is a shared host. How about if I create it using code behind on the server, will this error persist? Once again, thanks for your help!

          Richard DeemingR Online
          Richard DeemingR Online
          Richard Deeming
          wrote on last edited by
          #4

          If your ASP.NET application has access to write to the config file, you could try encrypting the config using code: Programmatically Encrypt the Connection String In ASP.NET Applications[^] Otherwise, you'll need to talk to your hosting provider to see what your options are.


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          O 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            If your ASP.NET application has access to write to the config file, you could try encrypting the config using code: Programmatically Encrypt the Connection String In ASP.NET Applications[^] Otherwise, you'll need to talk to your hosting provider to see what your options are.


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            O Offline
            O Offline
            Otekpo Emmanuel
            wrote on last edited by
            #5

            K. Thanks

            1 Reply Last reply
            0
            • O Otekpo Emmanuel

              Hi there, I want to encrypt my site web.config file for security purposes and why searching codeproject for this topic, I found this useful link https://www.codeproject.com/Tips/795135/Encrypt-ConnectionString-in-Web-Config I followed the steps and was able to encrypt the connection strings on my local system. Now, I copied the web.config file to my host server root directory. Then on loading the site, I got this error-: Parser Error Message: Failed to decrypt using provider 'RsaProtectedConfigurationProvider'. Error message from the provider: Bad Data. Then I tried searching the net and codeproject for solution but none was found by me pointing to error why uploaded to server. Maybe am not using the right keywords! However, I came across a link that suggested I should change Or Which I did but no luck. But I believe someone here on codeproject has the solution. So my question is, how can I make this to work after uploading to server? Note: Am using shared hosting for now so I don't have admin rights to do anything on the server. Thanks in advance!

              O Offline
              O Offline
              Otekpo Emmanuel
              wrote on last edited by
              #6

              I have finally solved this through the help of many valuable suggestions. The problem I was having was as a result of not granting write and read permission to ASP.net.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups