In ASP.NET 2.0, it's fairly easy :
Dim configPath As String = "/yourVirtualApplicationPath"
Dim config As System.Configuration.Configuration = WebConfigurationManager.OpenWebConfiguration(confi gPath)
Dim configSection As System.Web.Configuration.GlobalizationSection = CType(config.GetSection("system.web/globalization"), _
System.Web.Configuration.GlobalizationSection)
lblMessage.Text = "The web.config's file path is : " & config.FilePath
lblMessage2.Text = "The configuration section's name is : " & configSection.SectionInformation.Name
lblMessage3.Text = "The configured culture is : " & configSection.Culture
lblMessage4.Text = "The configured uiCulture is : " & configSection.uiCulture
lblMessage5.Text = "The configured requestEncoding is : " & configSection.RequestEncoding.ToString()
lblMessage6.Text = "The configured responseEncoding is : " & configSection.ResponseEncoding.ToString()
lblMessage7.Text = "The configured fileEncoding is : " & configSection.FileEncoding.ToString()
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**************@TK2MSFTNGP10.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.Collections.Specialized.NameValueCollection
test = CType
(System.Configuration.ConfigurationSettings.GetCon fig("appSettings"),
System.Collections.Specialized.NameValueCollection )
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>
<globalization requestEncoding="iso-8859-1"
responseEncoding="iso-8859-1"
culture="fr-FR" uiCulture="fr-FR" />
Dim testAs System.Collections.Specialized.NameValueCollection
test= CType
(System.Configuration.ConfigurationSettings.GetCon fig("system.web/globalization"),
System.Collections.Specialized.NameValueCollection )
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