PC Review


Reply
Thread Tools Rate Thread

Connection strings and resource files

 
 
Mike P
Guest
Posts: n/a
 
      3rd May 2007
I've always put my connection strings in the web.config, but I've just
recently seen an example of a connection string in a resource file.
What are the advantages of doing this, and could you do it for other
stuff that you would normally put in your web.config?



*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
 
 
 
Andy
Guest
Posts: n/a
 
      3rd May 2007
On May 3, 8:00 am, Mike P <mike.p...@gmail.com> wrote:
> I've always put my connection strings in the web.config, but I've just
> recently seen an example of a connection string in a resource file.
> What are the advantages of doing this, and could you do it for other
> stuff that you would normally put in your web.config?


There's not advantage, infact its a disadvantage. The connection
string is one of those things you'd like to be able to change without
recompiling the code. Put your string in a resource file, and you've
lost this ability. You also lose the ability to use connection string
encyption (if you're on .net 2).

Resource files are most useful for static strings (which an end user
may see), so that you don't have to hardcode them into code,
especially if you are going to localize your application. If you're
localizing, you simply create another resx file for the culture you're
targeting and translate all the strings there and you're done.

 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      3rd May 2007
"Mike P" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> I've always put my connection strings in the web.config,


Me too...

> but I've just recently seen an example of a connection string in a
> resource
> file. What are the advantages of doing this,


None that spring readily to mind...


> and could you do it for other stuff that you would normally put in your
> web.config?


Sure - why not...?


--
http://www.markrae.net

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Disposing strings created from a resource file using resource mana =?Utf-8?B?TXVydGh5?= Microsoft Dot NET Compact Framework 3 25th Jun 2007 03:30 PM
Read the connection strings in all web.config files in a box =?Utf-8?B?U2JhdGNodQ==?= Microsoft C# .NET 2 26th Apr 2007 05:54 AM
Strings and Resource Files dwyer.bill@gmail.com Microsoft VB .NET 4 14th Dec 2006 02:02 AM
Reusing connection strings in config files? Jen Microsoft C# .NET 1 14th Jun 2006 03:29 PM
Managing strings stored in resource files of a localizable application Maksim Izbrodin Microsoft Dot NET Framework 3 8th Dec 2003 02:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:44 AM.