asp.net - How to Automatically Encrypt Web.config after installation -


i created web app. want encrypt web.config of application.

i've tried cmd method , worked. want make auto encypted after installation. can me.

you don't need encrypt whole web.config file. if keep connection string variable in web.config, can encrypt it.

you can use following command encrypt connectionstrings.

aspnet_regiis -pe "connectionstrings" -app "/sampleapplication" 

after process web.config files looks following example.

<configuration>    <connectionstrings configprotectionprovider="rsaprotectedconfigurationprovider">       <encrypteddata type="http://www.w3.org/2001/04/xmlenc#element"          xmlns="http://www.w3.org/2001/04/xmlenc#">          <encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />          <keyinfo xmlns="http://www.w3.org/2000/09/xmldsig#">             <encryptedkey xmlns="http://www.w3.org/2001/04/xmlenc#">                <encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />                <keyinfo xmlns="http://www.w3.org/2000/09/xmldsig#">                   <keyname>rsa key                   </keyname>                </keyinfo>                <cipherdata>                   <ciphervalue>wcfebdx8vylfasvk8g6hzvag1674zfc1kwh0boazgowdbfinhcamqmnin0ohtz5to2exgl+dyh10giemo9nemh4yzk+imiln+itceay9cgwmxsen9uqlpcqhqqmjerzipk4qpzarwwqcklqricl9x8x9oe7jkiso2ibapwj+1jo=                   </ciphervalue>                </cipherdata>             </encryptedkey>          </keyinfo>          <cipherdata>             <ciphervalue>opwqgqbq2wbzegyaev8wf82yz6q5wnfij3rcuq8gt0mp97ao9shizwwnggsei2ywi4omahx9p0najxg76aomr9l/wasaxewzqz3fexfgfsrgpful/5txsptagcqub1pebvlb9ca71uxigvcptiwf7zydu8sshhwa0fnxqvhhdlqyy1dfhxs3co61vw5e/kymkoga4mjqt0vzaxgb9tvegbdhjph5zlrlmnfysozej+m2lsm7hnf6vvfm3ffmxa6+h0jthecxbdmzg/vqb0u3oejsgzb4ly+v9o0t4yxkwn9kvdw58phoert2//3izfjfwv2nz4e6vj4byjf81o3jvngrjmm9hr9blvbbt3q8/j5zj+telcn6zphvnub70ig2kpjxqaj2gbzbk6chq+wneboqnwib7dtpumuzk0yw1xdz5gkfbuqgn8hmoste7mcviep9rgatf6qglgda6zyyvv6wdjo1qbcv807lczxa3bf5kzkavusq5fs1spdzkae6/kkr0ps++ce=             </ciphervalue>          </cipherdata>       </encrypteddata>    </connectionstrings> </configuration> 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -