Settings.settings file with settings for multiple regions

I thought of using Settings.settings feature that is new to .NET for
storing connection strings info for TEST, INT and PROD regions.
Currently we prefix the appSettings keys with TEST, INT and PROD in
web.config (or app.config). For instance in my web.config I have
following keys:

<appSettings>
<add key="TEST.Connection" value = "......" />
<add key="INT.Connection" value = "......" />
<add key="PROD.Connection" value = "......" />
</appSettings>

When we deploy application to each region we set the value of server
variable ENVIRONMENT to "TEST", "INT" and "PROD".

We then use following to get conn string :

string connstring = [AppSettingsReader obj].GetValue( ENVIRONMENT +
".Connection")

This gives us TEST connection string in TEST region, INT conn string
in INT region etc.

I would like to do something similar with Settings.settings file. Any
ideas.


0
donet
11/19/2009 7:26:26 PM
dotnet.framework.aspnet 1425 articles. 0 followers. Follow

3 Replies
676 Views

Similar Articles

[PageSpeed] 51

donet programmer <arpit.00@gmail.com> wrote in news:e1d08968-9837-44b1-
a00d-4ed63fde8b70@m16g2000yqc.googlegroups.com:

> I thought of using Settings.settings feature that is new to .NET for
> storing connection strings info for TEST, INT and PROD regions.
> Currently we prefix the appSettings keys with TEST, INT and PROD in
> web.config (or app.config). For instance in my web.config I have
> following keys:
> 
> <appSettings>
> <add key="TEST.Connection" value = "......" />
> <add key="INT.Connection" value = "......" />
> <add key="PROD.Connection" value = "......" />
> </appSettings>
> 
> When we deploy application to each region we set the value of server
> variable ENVIRONMENT to "TEST", "INT" and "PROD".
> 
> We then use following to get conn string :
> 
> string connstring = [AppSettingsReader obj].GetValue( ENVIRONMENT +
> ".Connection")
> 
> This gives us TEST connection string in TEST region, INT conn string
> in INT region etc.

You don't want to do this going forward, or at least it is not likely 
you want to continue this direction. In .NET 4.0 (release 1Q 2010), 
there are provisions for altering a config file on deploy, so there is 
no reason to consider this form of change for common config settings.

As .NET 4.0 is Go Live now, you might consider looking at the impact up 
"upgrading" on your project and switching. No, I would not normally 
suggest going into a beta cycle, but your needs match what they are 
doing now. And the release is not that far away. And the Go Live means 
Microsoft has guaranteed an upgrade path for beta 2.

Peace and Grace,
Greg



-- 
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

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

*******************************************
|      Think outside the box!             |
*******************************************
0
Gregory
11/19/2009 8:08:55 PM
Thanks greg for the info. We currently use .NET 3.0 which we only
recently switched to so no idea how long till we use .NET 4.0.

I was able to resolve the issue and able to store multiple sets of
values in my app.config file and still use intellisense to get its
value. For those interested I am attaching the link below :

http://blogs.msdn.com/johan_stenbergs_blog/archive/2005/11/11/491998.aspx

Thanks
0
donet
11/19/2009 10:20:22 PM
donet programmer <arpit.00@gmail.com> wrote in news:e65c8ba0-77bb-463f-
99e3-1f535f7aafd8@b15g2000yqd.googlegroups.com:

> Thanks greg for the info. We currently use .NET 3.0 which we only
> recently switched to so no idea how long till we use .NET 4.0.
> 
> I was able to resolve the issue and able to store multiple sets of
> values in my app.config file and still use intellisense to get its
> value. For those interested I am attaching the link below :
> 
> http://blogs.msdn.com/johan_stenbergs_blog/archive/2005/11/11/491998.aspx

That is good info. If you get a chance, look at what .NET 4.0 is doing, 
however, and abstract in a similar manner. It will make it easy to switch.

Peace and Grace,
Greg

-- 
Vote for Miranda's Christmas Story
http://tinyurl.com/mirandabelieve

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

*******************************************
|      Think outside the box!             |
*******************************************
0
Gregory
11/20/2009 3:05:27 PM
Reply:

Similar Artilces:

setting up new outlook mail account
i can not set up a new account on my outlook, i keep saying establish network connection with a correct sign but searching for my mail account shows X can you please advise Are you trying to setup a POP3 mail account or an Exchange account? Also, what version of Outlook are you using? "rashid" <rashid@discussions.microsoft.com> wrote in message news:C59D04C0-C1C9-4BD1-AE00-2009D25B221D@microsoft.com... > i can not set up a new account on my outlook, i keep saying establish > network > connection with a correct sign but searching for my mail account shows X > ...

How do I set up an argument which asks for multiple criteria
I am trying to use an argument that asks for one of three criteria (2345P, 8319T, or 7026J) in cell C108, and if it finds it, enters the amount of yet another cell, G108 into cell K108, and if not enters 0 into cell K108. It seems there are too many arguments for the "if" argument, and I can't seem to get the "lookup" argument to work either. Is there another argument I should be working with? Thanks -- Diver Try: =IF(OR(C108="8319T",C108="2345P",C108="7026J"),G108,0) "bj" wrote: > try in K108 > =if(or(c108=&qu...

OWA Set Rule problem
I have successfully install the Exchange 2003 with SP1 in the Windows Server 2003. Anything alright exclude the rules function in OWA. I try to set the rules from any then "move to" or "copy to" specify folder are no problem, but "forward to" other email address, its don't work. I try to input the email address in the contact and then select from the contact, but the result also don't work. The rules can save and I can receive the incoming email in the Exchange 2003/Outlook or OWA, but it don't forward to my specify email address. I try to...

Latest version of Excel that will read Excel 5 files
Will Excel 2002 read Excel 5 files? What about Excel 2003? --- Message posted from http://www.ExcelForum.com/ Hi will do. My Excel 2003 reads and saves Excel 95 files as well Frank > Will Excel 2002 read Excel 5 files? What about Excel 2003? Just to be sure there's no misunderstanding, I meant Excel 5.0, the version that preceded Office 95. Excel 5.0, when packaged with Office, was part of Office 4.3. --- Message posted from http://www.ExcelForum.com/ Yes -- Regards, Peo Sjoblom "dderolph >" <<dderolph.10lrct@excelforum-nospam.com> wrote in mes...

How do I set the 'Set Synchronizing Client' field
We have a number of outlook clients using CRM that have the 'Set Synchronizing Client' select box greyed out. We need to tick them so that they are able to synchronize tasks etc. Can any one help me find out why these are greyed out and then set them so that they can synchronize thanks In my experience, that checkbox is always greyed out for the first install that is performed for a user. The only time that checkbox becomes active is if a second copy of CRM is installed for a user who already has CRM installed on another PC.... Normally the box is checked and grey. If that is...

Can't Restore a Password Protected File
I have never used a Passport but the Money File is password protected. I've never been able to restore a backup because it wants to use my Passport but the Passport is NOT associated with the Money File (so when I do try to use the Passport, it tells me it isn't associated...duh). I've been using Money 2003 and have now upgraded to 2005 but can't get to any of my info from the backup. I have lots of backups but can't restore ANY of them in 2003 or 2005. Help please... In microsoft.public.money, Andy wrote: > have never used a Passport but the Money File is pa...

How to set backcolour
Hello All I have a continuous form containing a number field (long integer) called [v_colour]. This field contains the number of a certain colour - as per the numbers that are used in the format properties for back colour etc. I would like to set the back colour for the form's [v_colour] text box to be the value of the field: e.g. If the value of [v_colour] in the first record is 255, I want the back colour of the textbox for that record to be bright red. I tried this as the OnLoad event for the form: [v_colour].backcolour = [v_colour].value .... but this resulted in the back colour of...

Applying Percent Decrease Across Set Periods
I have a column which includes dates when items were purchased. I have used the DATEDIF function to find the number of years between that date and today's date. I now want to decrease the purchase amount 10% for every year calculated via the DATEDIF function. Any ideas, is this possible, why can't I think...? -- Hunt&amp;Peck ------------------------------------------------------------------------ Hunt&amp;Peck's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=32961 View this thread: http://www.excelforum.com/showthread.php?threadid=527873 ...

File format specification
Can anybody please recommend a document giving the detail of the ASCII file specification relating to the importation of data into EXCEL from an external application Thank you very much I'm not sure I understand your question. Wouldn't the specification be dependent upon the layout of the text file. And text files could have lots of different formats. Nick wrote: > > Can anybody please recommend a document giving the detail of the ASCII file > specification relating to the importation of data into EXCEL from an > external application > > Thank you very much ...

Create one class in order to connect with multiple tables.
Create one class in order to connect with multiple tables. I always create one new class for one table in order to connect it via wizard. So,I had created ten classes for ten tables. Can you teache me how to create one new class which it can connect to multiple tables? Thanks in advance. Sam, I would assume that you are referening the MFC ODBC classes - specifically the CRecordset. If that is the case, then you have but a few options. If your recordsets are read-only, then you do not have to use a derived class - you can create an object of CRecordset, and use one of the GetFeildValue...

Set Regional Settings but not Language
Hi I have a multi-language APP en-US, es-ES, it-IT I usually change Languages and Locales by using the CultureInfo to switch Languages System.Globalization.CultureInfo myCI = new System.Globalization.CultureInfo("es-ES"); My issue is - what if the user wants to View App in english and use the Regional Options on a PC in say Spain ??? If I change the CultureInfo to en-US then they can view APP in English ( English satelite assemblies) but date and numbers will be in US format If I change the CultureInfo to es-ES then date and numbers will be in Spain forma...

Reading Pane Settings
I did a search for an answer to this question and have not found one. If I missed an answer already posted, please direct me to the right place. I have Outlook 2007 and set up the "right" reading pane for my e-mail. Now when I go to my calendar it is set up the same way - calendar on the left (same size as the inbox) and then there is a blank space to the right that is the size of the reading pane/preview. To the right is the to-do bar (which I have no problem with). I don't know why there is a reading/preview pane on the calendar when there is nothing to preview, and I...

Work Hours setting excludes specified hours from Scheduling
I am miffed by this problem. I specify a work hour schedule for a user. When I schedule a CRM User as a Resource for a Service in Scheduling of a Service Activity with Requested Time of ASAP and click Find Available Times, the values for Avilable Times returned are outside of the Work Hours I specified for the user and not within the work hours. When I drill into the Work Hours for this User, the Calendar view shows Cross Day rather than 8:00AM - 5:00PM I speciied for work hours and editing the hours reveal the correct hours in the Work Hours. What gives? Never mind. Figured out w...

Attach file but send dir image
I attach a file to my email. I send the email and also three other messages with attached images of my directory lists. How do I stop sending these images? Why are they being sent? Outlook 2000 I am running Norton AntiVirus to filter both the incoming and the outgoing mail. The problem occurs in the filtering of the outgoing mail. NAV support suggests that the problem is a corrupted Symantec Redirector and directed me to their document# 200205160084213 - How to update the Symantec Redirector files. >-----Original Message----- >I attach a file to my email. >I send the email and al...

Digital File Attacments to Transactions
Another question... I see that Quicken 2006 has resurrected a feature they included in one of their earlier versions; the ability to attach digital images to transactions (paycheck stubs, receipts,...whatever). This was a *terrific* feature and really loved it. It saved me a *lot* of trouble, particularly when I had to produce a receipt for an item that I had purchased a long time ago, yet was still under warranty. I could go on about how useful this feature was to me, but I digress... I was a loyal user of Quicken and TurboTax almost since the beginning, that is until the TurboTax ...

Path\File name length problem Excel Crash on save as
I have a problem saving a file in code using: thisworkbook.SaveAs The problem is if the file and path length is greater than 150 then the Excel app crashes. I have tried this over a network as well as a local drive. Has anyone ever seen this problem? Thanks in advance, Stewart Rogers ...

Outlook "Arrange By" option does not retain its setting
In outlook 2007, I use a custom view for my inbox, and I have the Group By option checked to"Automatically group according to arrangement." This has been workn flawlessly until today, when I realized Outlook did not like a particular mouse click; perhaps I clicked on the border of two options or some other anomoly that caused the window toflash once. The end result was that my Arrange By option changed to "From" when I had previously set it to "Conversation." Now, whenever I hange it backto "Conversation," leave the inbox and come back, ...

Excel File
When we received a excel file through mail , while opening the file i received a error :corrupt file, run repair to to extract the contents. The same file when opened on another PC received an error : read only. Please asuggest a immediate solution Can you right-click the file, go to properties and uncheck read only? -- Sincerely, Michael Colvin "ritu" wrote: > When we received a excel file through mail , while opening the file i > received a error :corrupt file, run repair to to extract the contents. > > The same file when opened on another PC received an error ...

Unsave file
Dear All, I have updated Excel file, but i was wrong to press the Button File Save to "NO". Please advice either there is any temporary file Excel in the computer...in order for me to save what i have done in updating the file... Your help is highly appreciated.. Andri Sorry, no. To save future tears, you may want to look at: file|saveas|tools|general options and check always create backup If you save, you'll get a backup copy built with a name like: backup of book1.xlk ===== And one tip that may help (also in the future)... If you know that you don't want to change ...

cannot delete or rename file on desktop
i have a file on my desktop named con.stock030801.xls. i cannot rename or delete this file. the message that pops up says that the file should be renamed but it wont let me. any suggestions? The problem is that "con." (con - dot - anything) is a Windows reserved name ("con" is short for "console" (the screen) and is used with command prompt commands). I don't know how it was created but generally it's not possible. For instance I cannot rename a file to your file's name, nor save a new one with that name in Excel. So this is not an Excel probl...

Is it possible to format a PSObject with a .ps1xml file?
This might be a totally ridiculous question...but here goes anyway: I have a couple of filters in modules that write PSObjects to output using code like: $x = New-Object PSObject -Property @{ one = "one" two = "two" } Write-Output $x There's just way more properties. How does one specify 'default' formatting styles for a System.Management.Automation.PSCustomObject like you can with other types using .ps1xml files? That may not even be the right question to ask. What I'd like would be a way to define the default formatting for ...

how to convert dat files?
I don't know how to convert .dat files into excel. Is it as simple as downloading an upgrade? How do I find out what file conversions are supported by excel? Hi you may explain from which program these dat files orginate -- Regards Frank Kabel Frankfurt, Germany "HungerArtist" <HungerArtist@discussions.microsoft.com> schrieb im Newsbeitrag news:C61EF460-CE8E-46D6-A793-BB9F0B6EF8BC@microsoft.com... > I don't know how to convert .dat files into excel. Is it as simple as > downloading an upgrade? > > How do I find out what file conversions are supported by...

How do I set OOR
I have searched the help menu and have had no luck finding out how to set my outlook 200 to send an OOR (Out of Office Reply) Any assistance would be great If you are in an Exchange environment (ask your administrator if you do notknow) you can set the Out of the Office Assistant which is located under Tools. If you are not in an Exchange environment you can create a rule that replies on all e-mails. The downside of this is that you'll have to have your Outlook open all the time for the rules to process. Make sure you set some exceptions (for instance based on the subject field so ...

Creation of .PST Files
Hi, I have a 3 GB mailbox that I need to copy in one or more .PST Files First of all, I need to know if there is an Exmerge version that create a more-than-2GB file (Like Outlook 2003) and If not, If there are an application that create and split automatically into 2GB file thanks in advance last i heard, exmerge is still limited to 2gb. usually i set a date range in order to get items pulled out of mailbox and into 2 or more pst files. "Javier Villegas" <jvillegas@elsitio.net> wrote in message news:O05byWLTEHA.3608@TK2MSFTNGP11.phx.gbl... > Hi, > > I have a 3 ...

Sharing Outlook data files across a home network
I have two computers hooked up to a network - a desktop hardwired to my router/modem and a laptop connected wirelessly to the router/modem. I run Outlook on the desktop to download and access all my emails and contacts, but i'd also like to be able to access all this data on my laptop. Basically, i want to synchonise my email and contacts on both machines in real time. Is there any way to do this? I have never found a way to do this with stand-alone Microsoft products over the last 6 years (unless you install an Exchange Server!). There are a few aftermarket solutions like ...