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; }
private static void EnsureProfileConfigLoaded() { if (_profileServiceEnabled == null) { #pragma warning disable 0436 ScriptingProfileServiceSection profileServiceSection = ScriptingProfileServiceSection.GetConfigurationSection(); #pragma warning restore 0436 Dictionary <string, object> readAccessProperties = null; Dictionary <string, object> writeAccessProperties = null; bool enabled = (profileServiceSection != null) && profileServiceSection.Enabled; if (enabled) { string[] enabledForRead = profileServiceSection.ReadAccessProperties; if (enabledForRead != null && enabledForRead.Length > 0) { readAccessProperties = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); ParseProfilePropertyList(readAccessProperties, enabledForRead); } string[] enabledForWriting = profileServiceSection.WriteAccessProperties; if (enabledForWriting != null && enabledForWriting.Length > 0) { writeAccessProperties = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase); ParseProfilePropertyList(writeAccessProperties, enabledForWriting); } } _profileAllowedGet = readAccessProperties; _profileAllowedSet = writeAccessProperties; _profileServiceEnabled = enabled; } }
public ProfileService() { _section = (ScriptingProfileServiceSection)WebConfigurationManager.GetSection("system.web.extensions/scripting/webServices/profileService"); }