edmx connection string

G

Gerhard

I am working on a Silverlight Business Application. I need to change the
connection string in code to use a specific user and password in Production.
I don't want the password sitting in a web.config file. How can I do this?
Thanks.
 
G

Gregory A. Beamer

Gerhard said:
I am working on a Silverlight Business Application. I need to change the
connection string in code to use a specific user and password in
Production.
I don't want the password sitting in a web.config file. How can I do
this?
Thanks.

Make sure you are asking the right question here, as the connection string
being configurable but not in .config is possible, but it is often better to
encrypt the string. If you want a user specific connection, you can use to a
trusted connection, which forces user log in. But if you want a single
account (SQL, not windows, auth), then you end up having to store that
string somewhere, and encrypting the string with the mechanisms present in
the web security namespace are the easiest methods of getting it done.

To easily deploy this, you can set the machine keys yourself, which also
solves the web farm problem.

--
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
| Think outside the box! |
************************************************
 
G

Gerhard

Thanks. Is there a tutorial on how to encrypt the string with the mechanisms
present in the web security namespace
 
G

Gregory A. Beamer

Gerhard said:
Thanks. Is there a tutorial on how to encrypt the string with the
mechanisms
present in the web security namespace

Not directly, but there are complementary methods that will automagically
unencrypt on the server.

This will work for a single machine (does not work for a farm, as it uses
the machine's keys):
http://msdn.microsoft.com/en-us/library/ms998280.aspx

The above is very secure, but also takes a bit of work. The easier method
is:
http://wiki.asp.net/page.aspx/1155/encrypt-connectionstrings-section-of-webconfig/

To set the machine keys easily:
http://aspnetresources.com/tools/keycreator.aspx

Also note that there is a facility in the Enterprise Library
(http://msdn.microsoft.com/en-us/library/dd203099.aspx) for encrypting
configuration elements, if you prefer to go that direction.

--
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
| Think outside the box! |
************************************************
 
M

Mr. Arnold

Gregory said:
Not directly, but there are complementary methods that will
automagically unencrypt on the server.

This will work for a single machine (does not work for a farm, as it
uses the machine's keys):
http://msdn.microsoft.com/en-us/library/ms998280.aspx

The above is very secure, but also takes a bit of work. The easier
method is:
http://wiki.asp.net/page.aspx/1155/encrypt-connectionstrings-section-of-webconfig/


To set the machine keys easily:
http://aspnetresources.com/tools/keycreator.aspx

Also note that there is a facility in the Enterprise Library
(http://msdn.microsoft.com/en-us/library/dd203099.aspx) for encrypting
configuration elements, if you prefer to go that direction.

Also, when creating the EF model, it's asked do you want to encrypt the
connection string.

The psw for SQL Server login should be encrypted too with some kind of
shift-key none shift-key alph-numeric-special keys combination to even
login to SQL Server at the SQL Server Manager.
 

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

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,698
Latest member
LydiaHalle

Latest Threads

Top