configSource option in web.config

G

Guest

I have a web.config file and I want to externalize my connectionStrings
setting so that it points to a separate file like so:

<connectionStrings configSource=".\subdir\connectionstrings.config">

However, I am attempting to encrypt this in code. (I can't use
aspnet_regiis because I need this to work for app.config files and on a build
machine as well.)
When I try to protect this file, it indicates that my
"connectionstrings.config" file is missing. When I use filemon, I can see
that it is looking in my c:\windows\microsoft.net\framework\v2.0.50727\subdir
directory instead of the subdirectory in which my config that I am protecting
is located. Can anyone tell me what's happening here? I have also tried
locating it in the same directory to no avail.

thanks in advance,

Linda
 
P

-pb-

I have a web.config file and I want to externalize my connectionStrings
setting so that it points to a separate file like so:

<connectionStrings configSource=".\subdir\connectionstrings.config">

However, I am attempting to encrypt this in code. (I can't use
aspnet_regiis because I need this to work for app.config files and on a build
machine as well.)
When I try to protect this file, it indicates that my
"connectionstrings.config" file is missing. When I use filemon, I can see
that it is looking in my c:\windows\microsoft.net\framework\v2.0.50727\subdir
directory instead of the subdirectory in which my config that I am protecting
is located. Can anyone tell me what's happening here? I have also tried
locating it in the same directory to no avail.

thanks in advance,

Linda

I am too sure about this but What I had observecd is when you run and
web application, it first gets compile and when it gets complied it is
placed under c:\windows\microsoft.net\framework\v2.0.50727 directory
and later gets executed from there. What you can do is instead og
using relative path to the connectionstrings.config file use absolute
path in the web config file.

I hope this helps
 
G

Guest

pb
Thanks for your response. I think that I read though that you can only use
relative paths in the configSource attribute - not absolute paths. I get
what you're saying about compilation though - that is probably my problem,
but I wish I could find a workaround for this.

Thanks,
Linda
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top