How can i disable Settings written to the app.config?


G

Guest

At first, I was trying to encrypt ConnectionStrings in my app.config and
still be able to modify my datasets. So, i had to modify the
Settings.Designer.cs file to handle the decryption aspect in the GET
properties. This works great to run the application but there are two
problems with it when developing at designtime.

1. Anytime i add another setting to Properties, the Designer rewrites the
Settings.Designer.cs overwritting my decryption handling code.

2. I cannot modify a dataset without getting an "Object ref no found"(this
happens because it doesn't recognize the encrypted connectionString).

Being that I've been struggling through this issue now for a little over a
week, I need to know how I can disable vs.net from wrtting my
connectionstring to the app.config in clear text. In other words, I want to
add ConnectionStrings to the Properties window but i don't want them to be
written in the app.config. Everytime i link a dataset to a connection in the
server explorer, vs.net automatiaclly adds the connectionString to my
app.config in clear text. This is a huge problem for us. We've tryed setting
up Protected Configuration but it seems to not work in Windows Applications.
 
Ad

Advertisements

M

Mary Chipman [MSFT]

Am I correct in assuming that you are using 2.0? Protected
configuration *does* work in Windows apps -- you need to set a
reference System.Configuration.dll. The other issue is which provider
to use -- DPAPI or RSA. DPAPI can only decrypt settings that were
encrypted on the same machine, so that limits its usefulness. If you
are writing code to handle encryption, I'd recommend encapsulating it
in a separate class. When you're done with the designers and ready to
deploy, hook it up and test it.

--Mary
 
G

Guest

Thanks for the response Mary. Yes, we are using 2.0 and we have decided we
don't want the connectionstring written to the app.config. Is this possibile
with the TableAdapter? It seems no matter what I do to the connectionstring,
the designer always writes it as a setting in the app.config.

Nuno
 
Ad

Advertisements

M

Mary Chipman [MSFT]

Is the connection string being created dynamically at runtime? You
might want to consider using one of the new ConnectionStringBuilders.
It allows you construct dynamic connection strings at runtime. This
avoids both hard-coding connection strings in your application and
storing them in a config file.

--Mary
 

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