views:

444

answers:

2

hi guys, I know that ppl have already asked questions regarding encrypting web.config.

im also trying to encrypt my test config file, but im getting this error.

aspnet_regiis -pef "connectionStrings" "C:\encryptedWeb.config" Encrypting configuration section... The configuration for physical path 'C:\EncryptedWeb.config' cannot be opened. Failed!

I just want to know, what could be reasons that it failed.

I got the answer, it was the readonly property of the web.config which was the problem. After I removed the readonly It worked like a charm.

A: 

Take a look at this , see if you set it up correctly

http://msdn.microsoft.com/en-us/library/ms998283.aspx

A possibiliity is to specify the site with -site "SiteName" otherwise it will use the default web site.

Stuart
I have two questions. First one can we individually test config file which is not a part of any application.And if I have two config files in my IIS, how to choose one of them.
alice7
No, a web.config needs to be in an appliaction. And, as far as I'm aware you only have one web.config per folder. I think 2 web configs is part of VS2010
Stuart
Web.config files are employed in a hierarchy, for instance, the root folder will have a web.config, but can be over ridden in sub folders with another web.config. Is that what you were asking?
Stuart
Actually my concern is I don't want to mess up my actual web.config if something goes wrong. SO I created a seperate config file just for testing.So you mean I have to work on my actual config file even if I like it or not.
alice7
work on the web.config, copy it before you change something you think could break it, name it something different, or save somewhere else
Stuart
Do you use source control for your app?
Stuart
yups we use TFS
alice7
A: 

You could try and use this tool to encrypt you web config

TWith2Sugars