thanks , it work
"Juan T. Llibre" <no***********@nowhere.com> 撰寫於郵件新聞:%2****************@TK2MSFTNGP09.phx .gbl...
You should have said you were using ASP.NET 2.0 from the start.
Actually, ConfigurationSettings.AppSettings["ConnectionString"]
WILL return data from an <appSettings...> section which does
*not* have the <connectionStrings> section.
If you *do* include a <connectionStrings> section, then you can use :
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
or
String connString =
ConfigurationManager.ConnectionStrings(ConnectionS tring).ConnectionString
Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ :
http://asp.net.do/faq/
ASPNETFAQ.COM :
http://www.aspnetfaq.com/
Foros de ASP.NET en Espa隳l :
http://asp.net.do/foros/
======================================
"Jason Chan" <no@email.com> wrote in message
news:uP**************@tk2msftngp13.phx.gbl...
seem that the ConfigurationSettings.AppSettings["ConnectionString"] is not
the correct statment to extract the string in asp.net 2.0, becos I cannot
do
it even in webapp
<configuration
xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=...."
ProviderName="System.Data.SqlClient"/>
</connectionStrings>
"Jason Chan" <no@email.com> 撰寫於郵件新聞:%2****************@TK2MSFTNGP12.phx .gbl...
I have a subfolder in a webapp
How can the aspx in the subfolder access the web.config in the webapp.
I.e. I stored the connectionstring in the \webapp\web.config
how the \webapp\subfolder\default.aspx extract the connection?
ConfigurationSettings.AppSettings["ConnectionString"] return empty string
Do I have to copy the web.config to the subfolder?