Read the connection strings in all web.config files in a box

G

Guest

How will i read connection strings in all web.config files in one particualr
machine?
 
G

Guest

ahh, with great difficulty!
You would have to do a search for all web.config files on the machine, load
each one, look for wherever the connection string (if any) is stored (it
could be in appSettings, or it could be in the newer connectionStrings
section).

You would do this via XPATH, since each web.config is an XML Document.

It sounds like you want to "change" all the connection strings. Possibly if
you know what you are doing you can use one of those search and replace in
files utilities.

Hope that helps,
Peter
 
G

Guest

true.theoritically true.

need to write the code in c# to accomodate the following steps

1.read all the folders under virtual directory
2.identify the websites having web.config
3.read all web.configs
4.use xpath to get conn strings..

would be greatful if we have a snippet of code to do this....

Thanks,
Sbatchu.
 

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