well i am trying to encrypt the connection string in the webconfig using Using RSA with a User-level Key Container.
Because the application must access the data using the same identity that you used to encrypt the data, you often need to run the encryption command using your application's service account identity. To do so, you can start a command Window by using the runas command as shown below specifying an appropriate domain and user name.
Runas /profile /user:domain\user cmd
When you run Aspnet_regiis from the resulting command window, it uses the specified identity to perform the encryption. This allows the application that uses the same identity to decrypt the data at run time.