config file on, in addition to the web.config file that's already
working in the application.
If I put the following in the web.config file (VS 2005, Framework 2.0),
I can retrieve the values fine:
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
I retrieve the value with this line in the codefile in one of the apps
on the page:
Session("MyExchangeServer") =
WebConfigurationManager.AppSettings("fileInputFolder").ToString
The placement of the above appsettings line is right after the
</system.webin the web.config file, and immediately before the
<system.netline.
Any of those values can be read with no problem if they're in the
web.config file.
I added a new item to my project, app.config.
It looks like this:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" />
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
It returns this message when I try to load the page.
The format of a configSource file must be an element containing the name
of the section. (C:\Inetpub\wwwroot\test\App.config line 10)
The only thing I have changed from the original app.config file was
where appSettings was already in the file, in the form <appSettings/>.
Where you see the <appSettingsand the 3-4 lines followed by the
</appSettings>, I simply replaced it.
The exact error on the page is:
Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.
Parser Error Message: The format of a configSource file must be an
element containing the name of the section.
Source Error:
Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
Line 9: -->
Line 10: <configuration>
Line 11: <appSettings>
Line 12: <add key="fileInputFolder" value="C:\National City
Downloads\test"/>
Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET Version:2.0.50727.210
Any idea what I am doing wrong on this? I'd like to do some more with
this alternate config file, but I'm just trying to get the simple stuff
to work, before I do anything else.
Thanks,
BCBlasting Cap,
The use of the ConfigSource attribute is as follows:
Each section that supports configSource gets specified as
<membership configSource="config\membership.config"/>
In the membership.config (name doesn't matter), you would specify only the
membership section.
<membership defaultProvider="CustomSqlMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="CustomSqlMembershipProvider"
connectionStringName="<connString>"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
applicationName="<appname>"
requiresUniqueEmail="false"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
maxInvalidPasswordAttempts="5"
passwordAttemptWindow="5"
passwordFormat="Hashed"
enablePasswordRetrieval="false"
enablePasswordReset="true"/>
</providers>
</membership>
Here is some more info:
http://weblogs.asp.net/fmarguerie/a...tion-files.aspx
Hope this helps,
Steve
"Blasting Cap" <goober@.christian.netwrote in message
news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.phx.gbl...
Quote:
Originally Posted by
>
I am working on a web app that I want to be able to use a separate config
file on, in addition to the web.config file that's already working in the
application.
>
If I put the following in the web.config file (VS 2005, Framework 2.0), I
can retrieve the values fine:
>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
>
I retrieve the value with this line in the codefile in one of the apps on
the page:
>
Session("MyExchangeServer") =
WebConfigurationManager.AppSettings("fileInputFolder").ToString
>
The placement of the above appsettings line is right after the
</system.webin the web.config file, and immediately before the
<system.netline.
>
Any of those values can be read with no problem if they're in the
web.config file.
>
I added a new item to my project, app.config.
>
It looks like this:
>
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial
Catalog=CIC_BankModel;Persist Security Info=True;User
ID=sa;Password=adminsql"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" />
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
>
<customErrors mode="RemoteOnly"
defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
>
</configuration>
>
>
It returns this message when I try to load the page.
>
The format of a configSource file must be an element containing the name
of the section. (C:\Inetpub\wwwroot\test\App.config line 10)
>
The only thing I have changed from the original app.config file was where
appSettings was already in the file, in the form <appSettings/>. Where you
see the <appSettingsand the 3-4 lines followed by the </appSettings>, I
simply replaced it.
>
The exact error on the page is:
>
Configuration Error
Description: An error occurred during the processing of a configuration
file required to service this request. Please review the specific error
details below and modify your configuration file appropriately.
>
Parser Error Message: The format of a configSource file must be an element
containing the name of the section.
>
Source Error:
>
>
Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
Line 9: -->
Line 10: <configuration>
Line 11: <appSettings>
Line 12: <add key="fileInputFolder" value="C:\National City
Downloads\test"/>
>
>
Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
>
>
------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42;
ASP.NET Version:2.0.50727.210
>
>
Any idea what I am doing wrong on this? I'd like to do some more with
this alternate config file, but I'm just trying to get the simple stuff to
work, before I do anything else.
>
Thanks,
>
BC
Steve -
thanks for the assistance. With your example and the link, I finally
saw what I was doing....
Thanks!!
BC
PlatinumBay wrote:
Quote:
Originally Posted by
Blasting Cap,
>
The use of the ConfigSource attribute is as follows:
>
Each section that supports configSource gets specified as
<membership configSource="config\membership.config"/>
>
In the membership.config (name doesn't matter), you would specify only the
membership section.
>
<membership defaultProvider="CustomSqlMembershipProvider"
userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="CustomSqlMembershipProvider"
connectionStringName="<connString>"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
applicationName="<appname>"
requiresUniqueEmail="false"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
maxInvalidPasswordAttempts="5"
passwordAttemptWindow="5"
passwordFormat="Hashed"
enablePasswordRetrieval="false"
enablePasswordReset="true"/>
</providers>
</membership>
>
Here is some more info:
http://weblogs.asp.net/fmarguerie/a...tion-files.aspx
>
Hope this helps,
>
>
Steve
>
"Blasting Cap" <goober@.christian.netwrote in message
news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.phx.gbl...
Quote:
Originally Posted by
>I am working on a web app that I want to be able to use a separate config
>file on, in addition to the web.config file that's already working in the
>application.
>>
>If I put the following in the web.config file (VS 2005, Framework 2.0), I
>can retrieve the values fine:
>>
><appSettings>
> <add key="fileInputFolder" value="C:\National City Downloads\test"/>
> <add key="fileTransaction" value="\Transactions\"/>
> <add key="TimerInterval" value="20000"/>
> <add key="Conn" value ="Data Source=dellserver\sql2000;Initial
>Catalog=CIC_BankModel;Persist Security Info=True;User
>ID=sa;Password=adminsql"/>
> </appSettings>
>>
>I retrieve the value with this line in the codefile in one of the apps on
>the page:
>>
>Session("MyExchangeServer") =
>WebConfigurationManager.AppSettings("fileInputFolder").ToString
>>
>The placement of the above appsettings line is right after the
></system.webin the web.config file, and immediately before the
><system.netline.
>>
>Any of those values can be read with no problem if they're in the
>web.config file.
>>
>I added a new item to my project, app.config.
>>
>It looks like this:
>>
><?xml version="1.0"?>
><!--
> Note: As an alternative to hand editing this file you can use the
> web admin tool to configure settings for your application. Use
> the Website->Asp.Net Configuration option in Visual Studio.
> A full list of settings and comments can be found in
> machine.config.comments usually located in
> \Windows\Microsoft.Net\Framework\v2.x\Config
>-->
><configuration>
> <appSettings>
> <add key="fileInputFolder" value="C:\National City Downloads\test"/>
> <add key="fileTransaction" value="\Transactions\"/>
> <add key="TimerInterval" value="20000"/>
> <add key="Conn" value ="Data Source=dellserver\sql2000;Initial
>Catalog=CIC_BankModel;Persist Security Info=True;User
>ID=sa;Password=adminsql"/>
> </appSettings>
> <connectionStrings/>
> <system.web>
> <!--
> Set compilation debug="true" to insert debugging
> symbols into the compiled page. Because this
> affects performance, set this value to true only
> during development.
> -->
> <compilation debug="false" />
> <!--
> The <authenticationsection enables configuration
> of the security authentication mode used by
> ASP.NET to identify an incoming user.
> -->
> <authentication mode="Windows" />
> <!--
> The <customErrorssection enables configuration
> of what to do if/when an unhandled error occurs
> during the execution of a request. Specifically,
> it enables developers to configure html error pages
> to be displayed in place of a error stack trace.
>>
> <customErrors mode="RemoteOnly"
>defaultRedirect="GenericErrorPage.htm">
> <error statusCode="403" redirect="NoAccess.htm" />
> <error statusCode="404" redirect="FileNotFound.htm" />
> </customErrors>
> -->
> </system.web>
>>
></configuration>
>>
>>
>It returns this message when I try to load the page.
>>
>The format of a configSource file must be an element containing the name
>of the section. (C:\Inetpub\wwwroot\test\App.config line 10)
>>
>The only thing I have changed from the original app.config file was where
>appSettings was already in the file, in the form <appSettings/>. Where you
>see the <appSettingsand the 3-4 lines followed by the </appSettings>, I
>simply replaced it.
>>
>The exact error on the page is:
>>
>Configuration Error
>Description: An error occurred during the processing of a configuration
>file required to service this request. Please review the specific error
>details below and modify your configuration file appropriately.
>>
>Parser Error Message: The format of a configSource file must be an element
>containing the name of the section.
>>
>Source Error:
>>
>>
>Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
>Line 9: -->
>Line 10: <configuration>
>Line 11: <appSettings>
>Line 12: <add key="fileInputFolder" value="C:\National City
>Downloads\test"/>
>>
>>
>Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
>>
>>
>------------------------
>Version Information: Microsoft .NET Framework Version:2.0.50727.42;
>ASP.NET Version:2.0.50727.210
>>
>>
>Any idea what I am doing wrong on this? I'd like to do some more with
>this alternate config file, but I'm just trying to get the simple stuff to
>work, before I do anything else.
>>
>Thanks,
>>
>BC
>
>
re:
!I want to be able to use a separate config file on, in addition to
!the web.config file that's already working in the application.
To use a separate config file for the appsettings section of web.config, use :
<appSettings configSource="somefile.config"/>
To enable the configuration to be recognized on any change to "somefile.config",
edit machine.config, in the <configSectionssection, and edit <section name="appSettings" ... >,
adding : restartOnExternalChanges="true"
That'd make it :
<section name="appSettings" type="System.Configuration.AppSettingsSection, System.Configuration,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" restartOnExternalChanges="true"
requirePermission="false" />
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
======================================
"Blasting Cap" <goober@.christian.netwrote in message news:eqYkXt4pHHA.1216@.TK2MSFTNGP03.phx.gbl...
Quote:
Originally Posted by
>
I am working on a web app that I want to be able to use a separate config file on, in addition to
the web.config file that's already working in the application.
>
If I put the following in the web.config file (VS 2005, Framework 2.0), I can retrieve the values
fine:
>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial Catalog=CIC_BankModel;Persist
Security Info=True;User ID=sa;Password=adminsql"/>
</appSettings>
>
I retrieve the value with this line in the codefile in one of the apps on the page:
>
Session("MyExchangeServer") = WebConfigurationManager.AppSettings("fileInputFolder").ToString
>
The placement of the above appsettings line is right after the </system.webin the web.config
file, and immediately before the <system.netline.
>
Any of those values can be read with no problem if they're in the web.config file.
>
I added a new item to my project, app.config.
>
It looks like this:
>
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="fileInputFolder" value="C:\National City Downloads\test"/>
<add key="fileTransaction" value="\Transactions\"/>
<add key="TimerInterval" value="20000"/>
<add key="Conn" value ="Data Source=dellserver\sql2000;Initial Catalog=CIC_BankModel;Persist
Security Info=True;User ID=sa;Password=adminsql"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" />
<!--
The <authenticationsection enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrorssection enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
>
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
>
</configuration>
>
>
It returns this message when I try to load the page.
>
The format of a configSource file must be an element containing the name of the section.
(C:\Inetpub\wwwroot\test\App.config line 10)
>
The only thing I have changed from the original app.config file was where appSettings was already
in the file, in the form <appSettings/>. Where you see the <appSettingsand the 3-4 lines
followed by the </appSettings>, I simply replaced it.
>
The exact error on the page is:
>
Configuration Error
Description: An error occurred during the processing of a configuration file required to service
this request. Please review the specific error details below and modify your configuration file
appropriately.
>
Parser Error Message: The format of a configSource file must be an element containing the name of
the section.
>
Source Error:
>
>
Line 8: \Windows\Microsoft.Net\Framework\v2.x\Config
Line 9: -->
Line 10: <configuration>
Line 11: <appSettings>
Line 12: <add key="fileInputFolder" value="C:\National City Downloads\test"/>
>
>
Source File: C:\Inetpub\wwwroot\test\App.config Line: 10
>
>
------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
>
>
Any idea what I am doing wrong on this? I'd like to do some more with this alternate config file,
but I'm just trying to get the simple stuff to work, before I do anything else.
>
Thanks,
>
BC
0 comments:
Post a Comment