By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Write Namevalue pair into Config file

P: n/a

Hi I have this constraint. A help would be greatly apprecitated.
I have this Config file.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="ITASCA">
<section name="ConnectionString"
type="System.NamevaluesectionHandler,System" />
</sectionGroup>
</configSections>

<ITASCA>
<ConnectionString>
<add key="projcode1" value="database"/>
<add key="projcode2" value="database2"/>
</ConnectionString>
</ITASCA>
I use VB.NET to read this section
I want to use DPAPI with Machine store. For this I have to read the
connection string from config file as name value pair, Then encrypt the
connection string & want to replace back the encrypted string into the
same section of config file.
I have a issue in writing into the same section. Couple somebody please
help me with writing as name value pair, as a attribute into the
section.
I used configuration management application block from microsoft to
write. But then I was unable to write as an attribute to a element in a
node.

A help would be greatly apprecitated.
Thanking you
Shaun

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
What exactly is your issue? How are you opening the config file? Are you
sure it's read/write?
What exception are you seeing?
--
HTH
Christoph Schittko [MVP, XmlInsider]
Software Architect, .NET Mentor
"Shaun Ram" <tr************@yahoo.com> wrote in message
news:ep**************@TK2MSFTNGP12.phx.gbl...

Hi I have this constraint. A help would be greatly apprecitated.
I have this Config file.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="ITASCA">
<section name="ConnectionString"
type="System.NamevaluesectionHandler,System" />
</sectionGroup>
</configSections>

<ITASCA>
<ConnectionString>
<add key="projcode1" value="database"/>
<add key="projcode2" value="database2"/>
</ConnectionString>
</ITASCA>
I use VB.NET to read this section
I want to use DPAPI with Machine store. For this I have to read the
connection string from config file as name value pair, Then encrypt the
connection string & want to replace back the encrypted string into the
same section of config file.
I have a issue in writing into the same section. Couple somebody please
help me with writing as name value pair, as a attribute into the
section.
I used configuration management application block from microsoft to
write. But then I was unable to write as an attribute to a element in a
node.

A help would be greatly apprecitated.
Thanking you
Shaun

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2

P: n/a
Thanks for responding.
The requirement is:
I have the connection string in web.config file. This needs to be
encrypted using DPAPI.
But I can't use Registry or user store(Can't use Serviced components to
load profile)
So I'm trying to implement DPAPI with Machine Store.

But then on the deployment server, if the connection string is encrypted
on developer's machine I will not be able to decrypt it on server end
for application,
So I though if I could Encrypt & write the connection string at runtime
to the config file at server end, I could also decrypt at the server
end. This way the developers could use the encrypted string from the
server. (This issue poses problem during production & deployment)

Another question, with DPAPI Machine store can I Remotely log-in into
the server & decrypt the connection string?
If this works then I will not have to write into config file.

Do you have any sugestions for this requirement
Thanking you in advance
Shaun

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.