Web.Config

  • Thread starter Thread starter WFB
  • Start date Start date
W

WFB

Hi,

I have an application with a couple of referenced assemblies. The
referenced assemblies and my application all share a few configuration
settings with the same name but different values. Is there a way to set up
the config file to recognize this? Im thinking <section name> elements, but
am not having much luck.

Thanks,
Joe
 
Joe,

Can you be more specific about what you're trying to do?

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.


--------------------
 
Hi,

Lets say the project has a StoreLocator assembly, a ProductGuide assembly
and the main web site. All three have a value in thier individual config
files named "connectionString", and in each case this value is different.
When the web site references them, they read the "connectionString" value
from the master (for lack of a better term) applications config file. I
would like to set up this config file somehow where I can store three
"connectionString" values, but each assembly knows which value belongs to
it.

I hope this clarifies it, and thanks for your help

Joe


Jim Cheshire said:
Joe,

Can you be more specific about what you're trying to do?

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.


--------------------
From: "WFB" <[email protected]>
Subject: Web.Config
Date: Thu, 30 Oct 2003 15:27:48 -0500
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: bkftpout.com 12.4.211.11
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:187643
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

I have an application with a couple of referenced assemblies. The
referenced assemblies and my application all share a few configuration
settings with the same name but different values. Is there a way to set up
the config file to recognize this? Im thinking <section name> elements, but
am not having much luck.

Thanks,
Joe
 
Joe,

Why not just use <appSettings> keys to specify the values you need?

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
Subject: Re: Web.Config
Date: Fri, 31 Oct 2003 12:22:02 -0500
Lines: 65
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: bkftpout.com 12.4.211.11
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:187828
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

Lets say the project has a StoreLocator assembly, a ProductGuide assembly
and the main web site. All three have a value in thier individual config
files named "connectionString", and in each case this value is different.
When the web site references them, they read the "connectionString" value
from the master (for lack of a better term) applications config file. I
would like to set up this config file somehow where I can store three
"connectionString" values, but each assembly knows which value belongs to
it.

I hope this clarifies it, and thanks for your help

Joe


Jim Cheshire said:
Joe,

Can you be more specific about what you're trying to do?

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.


--------------------
From: "WFB" <[email protected]>
Subject: Web.Config
Date: Thu, 30 Oct 2003 15:27:48 -0500
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: bkftpout.com 12.4.211.11
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:187643
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

I have an application with a couple of referenced assemblies. The
referenced assemblies and my application all share a few configuration
settings with the same name but different values. Is there a way to set up
the config file to recognize this? Im thinking <section name> elements, but
am not having much luck.

Thanks,
Joe
 
If I did that I would end up with something like this


<appSettings>
<add key="connectionString"
value="server=app;database=app;uid=appuser;pwd=pass" />
<add key="connectionString"
value="server=SL;database=StoreLocator;uid=sluser;pwd=slpass" />
<add key="connectionString"
value="server=PG;database=ProductGuideDatabase;uid=pguser;pwd=pgpass" />
</appSettings>

And what I think I would need would be something like

<appSettings>
<add key="connectionString"
value="server=app;database=app;uid=appuser;pwd=pass" />
</appSettings>


<StoreLocator>
<add key="connectionString"
value="server=SL;database=StoreLocator;uid=sluser;pwd=slpass" />
</StoreLocator>

<ProductGuide>
<add key="connectionString"
value="server=PG;database=PG;uid=pguser;pwd=pgpass" />
</ProductGuide>

Thanks for your help and patience,

Joe



Jim Cheshire said:
Joe,

Why not just use <appSettings> keys to specify the values you need?

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
Subject: Re: Web.Config
Date: Fri, 31 Oct 2003 12:22:02 -0500
Lines: 65
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: bkftpout.com 12.4.211.11
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:187828
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

Lets say the project has a StoreLocator assembly, a ProductGuide assembly
and the main web site. All three have a value in thier individual config
files named "connectionString", and in each case this value is different.
When the web site references them, they read the "connectionString" value
from the master (for lack of a better term) applications config file. I
would like to set up this config file somehow where I can store three
"connectionString" values, but each assembly knows which value belongs to
it.

I hope this clarifies it, and thanks for your help

Joe


Jim Cheshire said:
Joe,

Can you be more specific about what you're trying to do?

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.


--------------------
From: "WFB" <[email protected]>
Subject: Web.Config
Date: Thu, 30 Oct 2003 15:27:48 -0500
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: bkftpout.com 12.4.211.11
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:187643
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

I have an application with a couple of referenced assemblies. The
referenced assemblies and my application all share a few configuration
settings with the same name but different values. Is there a way to
set
up
the config file to recognize this? Im thinking <section name> elements,
but
am not having much luck.

Thanks,
Joe
 
Joe,

You would have to have unique keys, so what you would really end up with is
this:

<appSettings>
<add key="appConnectionString"
value="server=app;database=app;uid=appuser;pwd=pass" />
<add key="slConnectionString"
value="server=SL;database=StoreLocator;uid=sluser;pwd=slpass" />
<add key="pgConnectionString"
value="server=PG;database=ProductGuideDatabase;uid=pguser;pwd=pgpass" />
</appSettings>

You would then simply assign the connection string to the proper key.

If that isn't going to work in your scenario, try and post back specific
limitations so that I can re-evaluate.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
<[email protected]>
Subject: Re: Web.Config
Date: Mon, 10 Nov 2003 15:12:42 -0500
Lines: 139
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: bkftpout.com 12.4.211.11
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:189836
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

If I did that I would end up with something like this


<appSettings>
<add key="connectionString"
value="server=app;database=app;uid=appuser;pwd=pass" />
<add key="connectionString"
value="server=SL;database=StoreLocator;uid=sluser;pwd=slpass" />
<add key="connectionString"
value="server=PG;database=ProductGuideDatabase;uid=pguser;pwd=pgpass" />
</appSettings>

And what I think I would need would be something like

<appSettings>
<add key="connectionString"
value="server=app;database=app;uid=appuser;pwd=pass" />
</appSettings>


<StoreLocator>
<add key="connectionString"
value="server=SL;database=StoreLocator;uid=sluser;pwd=slpass" />
</StoreLocator>

<ProductGuide>
<add key="connectionString"
value="server=PG;database=PG;uid=pguser;pwd=pgpass" />
</ProductGuide>

Thanks for your help and patience,

Joe



Jim Cheshire said:
Joe,

Why not just use <appSettings> keys to specify the values you need?

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
Subject: Re: Web.Config
Date: Fri, 31 Oct 2003 12:22:02 -0500
Lines: 65
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: bkftpout.com 12.4.211.11
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:187828
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

Lets say the project has a StoreLocator assembly, a ProductGuide assembly
and the main web site. All three have a value in thier individual config
files named "connectionString", and in each case this value is different.
When the web site references them, they read the "connectionString" value
from the master (for lack of a better term) applications config file. I
would like to set up this config file somehow where I can store three
"connectionString" values, but each assembly knows which value belongs to
it.

I hope this clarifies it, and thanks for your help

Joe


Joe,

Can you be more specific about what you're trying to do?

Jim Cheshire [MSFT]
Developer Support
ASP.NET
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.


--------------------
From: "WFB" <[email protected]>
Subject: Web.Config
Date: Thu, 30 Oct 2003 15:27:48 -0500
Lines: 12
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: bkftpout.com 12.4.211.11
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet:187643
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi,

I have an application with a couple of referenced assemblies. The
referenced assemblies and my application all share a few configuration
settings with the same name but different values. Is there a way to set
up
the config file to recognize this? Im thinking <section name> elements,
but
am not having much luck.

Thanks,
Joe
 
Back
Top