In ASP.NET 2.0, it's fairly easy :
Dim configPath As String = "/yourVirtualAppl icationPath"
Dim config As System.Configur ation.Configura tion = WebConfiguratio nManager.OpenWe bConfiguration( configPath)
Dim configSection As System.Web.Conf iguration.Globa lizationSection = CType(config.Ge tSection("syste m.web/globalization") , _
System.Web.Conf iguration.Globa lizationSection )
lblMessage.Text = "The web.config's file path is : " & config.FilePath
lblMessage2.Tex t = "The configuration section's name is : " & configSection.S ectionInformati on.Name
lblMessage3.Tex t = "The configured culture is : " & configSection.C ulture
lblMessage4.Tex t = "The configured uiCulture is : " & configSection.u iCulture
lblMessage5.Tex t = "The configured requestEncoding is : " & configSection.R equestEncoding. ToString()
lblMessage6.Tex t = "The configured responseEncodin g is : " & configSection.R esponseEncoding .ToString()
lblMessage7.Tex t = "The configured fileEncoding is : " & configSection.F ileEncoding.ToS tring()
etc...
Juan T. Llibre
ASP.NET.FAQ :
http://asp.net.do/faq/
ASPNETFAQ.COM :
http://www.aspnetfaq.com/
Foros de ASP.NET en Español :
http://asp.net.do/foros/
=============== =============== ========
"fabrice" <em******@test. com> wrote in message news:OU******** ******@TK2MSFTN GP10.phx.gbl...
Hello,
Is that a way for reading section of the web.config by code ?
I m able to read the section <appSettings> like this :
<appSettings>
<add key="AppVer" value="Version 0.8 beta"/>
</appSettings>
Dim test As System.Collecti ons.Specialized .NameValueColle ction
test = CType
(System.Configu ration.Configur ationSettings.G etConfig("appSe ttings"),
System.Collecti ons.Specialized .NameValueColle ction)
dim mytest as string = CType (test("AppVer") , String )
response.write( mytest)
And it's OK
But i can't with the section globalization
<system.web>
<globalizatio n requestEncoding ="iso-8859-1"
responseEncodin g="iso-8859-1"
culture="fr-FR" uiCulture="fr-FR" />
Dim testAs System.Collecti ons.Specialized .NameValueColle ction
test= CType
(System.Configu ration.Configur ationSettings.G etConfig("syste m.web/globalization") ,
System.Collecti ons.Specialized .NameValueColle ction)
dim mytest as string = CType (test("culture" ), String )
'response.write (mytest)
it does not work.
How can i get information in globalization section ?
thanks
fabrice