Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Encrypting/Decrypting Connection String

Reply
Thread Tools

Encrypting/Decrypting Connection String

 
 
VB Programmer
Guest
Posts: n/a
 
      11-29-2004
I have my SQL Server connectionstring in my web.config file. I'm scared
that someone will open the file and get my username/password. How do I
encrypt, then decrypt the connection string in the web.config file?


 
Reply With Quote
 
 
 
 
=?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=
Guest
Posts: n/a
 
      11-29-2004
User the DP API provided by Microsoft or use the .net crypto api which is
included in the .net framework. Essentally, you will have to write a app
that would encrypt this connection string, then copy and paste it in your
web.config. Then you will have to implement a funciton in your code to
decrypt the string.

"VB Programmer" wrote:

> I have my SQL Server connectionstring in my web.config file. I'm scared
> that someone will open the file and get my username/password. How do I
> encrypt, then decrypt the connection string in the web.config file?
>
>
>

 
Reply With Quote
 
 
 
 
Steve C. Orr [MVP, MCSD]
Guest
Posts: n/a
 
      11-29-2004
One of the best techniques is to use a trusted connection. That way you
don't need
to list a username or password so there is nothing to hide.
If this is not possible, you can alternately store the username and password
encrypted
in the registry.
Here's more information:
http://msdn.microsoft.com/library/de...itysection.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net



"VB Programmer" <Dont*NoSpam-Please*@jEmail.com> wrote in message
news:...
>I have my SQL Server connectionstring in my web.config file. I'm scared
>that someone will open the file and get my username/password. How do I
>encrypt, then decrypt the connection string in the web.config file?
>



 
Reply With Quote
 
Sahil Malik
Guest
Posts: n/a
 
      11-30-2004
In addition to Steve's reply you might also find the following valuable -

(How To Store an Encrypted Connection String in the Registry)
http://msdn.microsoft.com/library/en...asp?frame=true

Might I add - there are mixed opinions about web apps accessing registry -
some guys think it's cool, some think it's not. My personal view is - as far
as security goes - that can be worked around in an acceptable manner - the
one issue the above mentioned link doesn't address is - registry is
SLOWWWWWWWW as a world war 2 tank !!!. (Like a WW2 tank .. it took a lot of
cra~p).

But then that can be worked around - it's easy - cache the connectionstring;
and setup a dependency similiar to FileDependecy or SqlDependency; and bingo
you just avoided the last argument against registry - performance.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik




"Steve C. Orr [MVP, MCSD]" <> wrote in message
news:...
> One of the best techniques is to use a trusted connection. That way you
> don't need
> to list a username or password so there is nothing to hide.
> If this is not possible, you can alternately store the username and
> password encrypted
> in the registry.
> Here's more information:
> http://msdn.microsoft.com/library/de...itysection.asp
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://Steve.Orr.net
>
>
>
> "VB Programmer" <Dont*NoSpam-Please*@jEmail.com> wrote in message
> news:...
>>I have my SQL Server connectionstring in my web.config file. I'm scared
>>that someone will open the file and get my username/password. How do I
>>encrypt, then decrypt the connection string in the web.config file?
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set the connection pool size in the Sybase connection string? Wei Lu ASP .Net 2 02-16-2009 09:51 AM
Web.config: connection string or connection key? rlueneberg@gmail.com ASP .Net 3 08-03-2007 09:37 PM
Connection String object Convert to String Variable Type =?Utf-8?B?TWlrZSBNb29yZQ==?= ASP .Net 2 10-26-2004 02:43 PM
Re: String.replaceAll(String regex, String replacement) question Mladen Adamovic Java 0 12-04-2003 04:40 PM
connection string exception : Format of the initialization string does not conform to specification starting at index 0 Gaurav ASP .Net 0 11-07-2003 10:24 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57