Files
mono/mcs/class/System.Web.Extensions/Test/AUT/System.Web.Configuration/ConfigSectionSample.cs
T
Yoni Klain 20a68f3a5f Moved remotely
svn path=/trunk/mcs/; revision=82545
2007-07-24 09:07:30 +00:00

60 lines
2.2 KiB
C#

using System;
using System.Web.Configuration;
public class ConfigSectionSample
{
public static void GetAuthServiceSection()
{
// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration("/aspnetTest");
// Get the external Web services section.
ScriptingWebServicesSectionGroup webServicesSection =
(ScriptingWebServicesSectionGroup)configuration.GetSectionGroup(
"system.web.extensions/scripting/webServices");
// Get the authentication service section.
ScriptingAuthenticationServiceSection authenticationSection =
webServicesSection.AuthenticationService;
}
public static void GetProfileServiceSection()
{
// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration("/aspnetTest");
// Get the external Web services section.
ScriptingWebServicesSectionGroup webServicesSection =
(ScriptingWebServicesSectionGroup)configuration.GetSectionGroup(
"system.web.extensions/scripting/webServices");
// Get the profile service section.
ScriptingProfileServiceSection profileSection =
webServicesSection.ProfileService;
}
public static void GetConverterElement()
{
// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration("/aspnetTest");
// Get the external JSON section.
ScriptingJsonSerializationSection jsonSection =
(ScriptingJsonSerializationSection)configuration.GetSection(
"system.web.extensions/scripting/webServices/jsonSerialization");
//Get the converters collection.
ConvertersCollection converters =
jsonSection.Converters;
if ((converters != null) && converters.Count > 0)
{
// Get the first registered converter.
Converter converterElement = converters[0];
}
}
}