Any section in my web.config file that I want to encrypt I run this command line util:
aspnet_regiis -pe “anySection” -app “/SampleApplication”
It all works just fine until I try encrypt my connectionStrings sections
I define (and I cannot change this) my connectionStrings section like this:
<connectionStrings>
<add key="myKey" value="myValue"/>
</connectionStrings>
But the “standard” way of defining it is like this:
<connectionStrings>
<add name="myName" connectionString="...." providerName="..." />
</connectionStrings>
How when I run:
aspnet_regiis -pe "connectionStrings" -app "/SampleApplication"
It errors with “…Unrecognized attribute ‘key’….”. If I change the connection string section to be the standard way it works fine. But I CANNOT use this format.
Is there a way of doing this using the aspnet_regiis util? Doing it with code is not an option for me.
Also is there a way to run this untility without specifing the application (-app “/SampleApplication”) instead giving the path to the web.config file?
thanks a million
It looks like you’ve copied and pasted an
appSetting<add key="myKey" value="myValue"/>is invalid sincekeyandvalueare not an attributes theconnectionStringelement expects.You will have to use the “standard”
<add name="myName" connectionString="...." />connectionStrings Element (ASP.NET Settings Schema)