Handling web.config file for adding encryptionkey
Step 1:
Need to add the key and value in the respective web application web.config file
Open the web.config
C:\inetpub\wwwroot\wss\VirtualDirectories\2020\web.config
Under the <appSettings> tag add your new key and value, refer the below snapshot
Step 2:
Access the key in your Webpart/Application Page
Add Reference - System.Configuration
Namespace: System.Configuration
Assembly: System.Configuration (in System.Configuration.dll)
Then get your current site and open the webconfiguration, refer the below snapshot
Web.Config file. Why?
You want to change your key. But you are not the developer? Or you do not even have the source! Then what? Thanks to the Web.configfile idea. Keep your secret key in the config file. Change it when you need to.
Step 1:
Need to add the key and value in the respective web application web.config file
Open the web.config
C:\inetpub\wwwroot\wss\VirtualDirectories\2020\web.config
Under the <appSettings> tag add your new key and value, refer the below snapshot
Step 2:
Access the key in your Webpart/Application Page
Add Reference - System.Configuration
Namespace: System.Configuration
Assembly: System.Configuration (in System.Configuration.dll)
Then get your current site and open the webconfiguration, refer the below snapshot
Web.Config file. Why?
You want to change your key. But you are not the developer? Or you do not even have the source! Then what? Thanks to the Web.configfile idea. Keep your secret key in the config file. Change it when you need to.
No comments:
Post a Comment