Encrypting appSettings Key In ASP.NET Web.config

I needed a solution to encrypt a single key in appSettings section in ASP.NET Web.config file. The article on MSDN Encrypting and Decrypting Configuration Sections tells about encrypting the whole section but I want to hide only a particular key.
It seems that apsnet_regiis could encrypt only sections, so I’ve found a way how to extract this key to another section and encrypt that section in one of StackOverflow answers http://stackoverflow.com/a/6224769

Here are the steps that must be done to get the result:
1. Add a line in configSections with the name of your new section

2. Add new section under configuration

3. In .NET code get the section and key from it

4. After you deploy your Web application to IIS, you should encrypt section secureAppSettings according to the MSDN article mentioned above. Launch Command Prompt as Administrator (it’s important!) and run command (something like this):

MVC. Placing Javascript Files In View Folder

When you need to split layout and JS code to different files, it might be convenient to place both files in Views/{ControllerName} folder. You need to change web.config file inside Views folder.

1. Add handler in <system.web> section

2. Add handler in <system.webServer> section before BlockViewHandler

Now you can include JavaScript file in your layout page.