/// <summary>
        /// Creates a configuration section handler.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext">Configuration context object.</param>
        /// <param name="section"></param>
        /// <returns>The created section handler object.</returns>
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            AjaxSettings settings = new AjaxSettings();

            Utility.AddDefaultConverter(settings);

            foreach (XmlNode n in section.ChildNodes)
            {
#if (!JSONLIB)
                if (n.Name == "urlClassMappings")
                {
                    settings.UseAssemblyQualifiedName = n.SelectSingleNode("@useAssemblyQualifiedName[.='true']") != null;

                    XmlNode ns, url;

                    foreach (XmlNode e in n.SelectNodes("add"))
                    {
                        ns  = e.SelectSingleNode("@type");
                        url = e.SelectSingleNode("@path");
#if (NET20)
                        if (ns == null || String.IsNullOrEmpty(ns.InnerText) || url == null || String.IsNullOrEmpty(url.InnerText))
#else
                        if (ns == null || ns.InnerText.Length == 0 || url == null || url.InnerText.Length == 0)
#endif
                        { continue; }

                        if (settings.UrlClassMappings.Contains(url.InnerText))
                        {
                            throw new Exception("Duplicate namespace mapping '" + url.InnerText + "'.");
                        }

                        settings.UrlClassMappings.Add(url.InnerText, ns.InnerText);
                    }
                }
                else if (n.Name == "security")
                {
                    if (n.SelectSingleNode("@provider") != null)
                    {
                        string securityProviderType = n.SelectSingleNode("@provider").InnerText;

                        AjaxSecurity sec = new AjaxSecurity(securityProviderType);

                        if (sec.Init())
                        {
                            settings.Security = sec;
                        }
                    }
                    if (n.SelectSingleNode("@token") != null)
                    {
                        // settings.TokenEnabled = n.SelectSingleNode("@enabled") != null && n.SelectSingleNode("@enabled").InnerText == "true";
                        settings.TokenSitePassword = n.SelectSingleNode("@token") != null?n.SelectSingleNode("@token").InnerText : settings.TokenSitePassword;
                    }
                }
                else if (n.Name == "typeJavaScriptGenerator")
                {
                    if (n.SelectSingleNode("@type") != null)
                    {
                        settings.TypeJavaScriptGenerator = n.SelectSingleNode("@type").InnerText;
                    }
                }
                else if (n.Name == "debug")
                {
                    if (n.SelectSingleNode("@enabled") != null && n.SelectSingleNode("@enabled").InnerText == "true")
                    {
                        settings.DebugEnabled = true;
                    }
                }
                else
#endif
                if (n.Name == "jsonConverters")
                {
                    if (n.SelectSingleNode("@includeTypeProperty") != null && n.SelectSingleNode("@includeTypeProperty").InnerText == "true")
                    {
                        settings.IncludeTypeProperty = true;
                    }
                    if (n.SelectSingleNode("@useSimpleObjectNaming") != null && n.SelectSingleNode("@useSimpleObjectNaming").InnerText == "true")
                    {
                        settings.UseSimpleObjectNaming = true;
                    }

                    XmlNodeList jsonConverters = n.SelectNodes("add");

                    foreach (XmlNode j in jsonConverters)
                    {
                        XmlNode t = j.SelectSingleNode("@type");

                        if (t == null)
                        {
                            continue;
                        }

                        Type type = Type.GetType(t.InnerText);

                        if (type == null)
                        {
                            // throw new ArgumentException("Could not find type " + t.InnerText + ".");
                            continue;
                        }

                        if (!typeof(JavaScriptConverter).IsAssignableFrom(type))
                        {
                            // throw new ArgumentException("Type " + t.InnerText + " does not inherit from JavaScriptObjectConverter.");
                            continue;
                        }

                        StringDictionary d = new StringDictionary();
                        foreach (XmlAttribute a in j.Attributes)
                        {
                            if (d.ContainsKey(a.Name))
                            {
                                continue;
                            }
                            d.Add(a.Name, a.Value);
                        }

                        JavaScriptConverter c = (JavaScriptConverter)Activator.CreateInstance(type);
                        c.Initialize(d);

                        Utility.AddConverter(settings, c, true);
                    }


                    jsonConverters = n.SelectNodes("remove");

                    foreach (XmlNode j in jsonConverters)
                    {
                        XmlNode t = j.SelectSingleNode("@type");

                        if (t == null)
                        {
                            continue;
                        }

                        Type type = Type.GetType(t.InnerText);

                        if (type == null)
                        {
                            // throw new ArgumentException("Could not find type " + t.InnerText + ".");
                            continue;
                        }

                        Utility.RemoveConverter(settings, type);
                    }
                }
            }

            return(settings);
        }
        /// <summary>
        /// Creates a configuration section handler.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext">Configuration context object.</param>
        /// <param name="section"></param>
        /// <returns>The created section handler object.</returns>
		public object Create(object parent, object configContext, System.Xml.XmlNode section)
		{
			AjaxSettings settings = new AjaxSettings();
			Utility.AddDefaultConverter(settings);

			foreach(XmlNode n in section.ChildNodes)
			{
#if(!JSONLIB)
				if(n.Name == "urlClassMappings")
				{
					settings.UseAssemblyQualifiedName = n.SelectSingleNode("@useAssemblyQualifiedName[.='true']") != null;

					XmlNode ns, url;

					foreach(XmlNode e in n.SelectNodes("add"))
					{
						ns = e.SelectSingleNode("@type");
						url = e.SelectSingleNode("@path");
#if(NET20)
						if(ns == null || String.IsNullOrEmpty(ns.InnerText) || url == null || String.IsNullOrEmpty(url.InnerText))
#else
						if(ns == null || ns.InnerText.Length == 0 || url == null || url.InnerText.Length == 0)
#endif
							continue;

						if(settings.UrlClassMappings.Contains(url.InnerText))
							throw new Exception("Duplicate namespace mapping '" + url.InnerText + "'.");

						settings.UrlClassMappings.Add(url.InnerText, ns.InnerText);
					}
				}
                else if (n.Name == "security")
                {
                    if (n.SelectSingleNode("@provider") != null)
                    {
                        string securityProviderType = n.SelectSingleNode("@provider").InnerText;

                        AjaxSecurity sec = new AjaxSecurity(securityProviderType);

                        if (sec.Init())
                        {
                            settings.Security = sec;
                        }
                    }
                    if (n.SelectSingleNode("@token") != null)
                    {
                        // settings.TokenEnabled = n.SelectSingleNode("@enabled") != null && n.SelectSingleNode("@enabled").InnerText == "true";
                        settings.TokenSitePassword = n.SelectSingleNode("@token") != null ? n.SelectSingleNode("@token").InnerText : settings.TokenSitePassword;
                    }
                }
                else if (n.Name == "typeJavaScriptGenerator")
                {
                    if (n.SelectSingleNode("@type") != null)
                    {
                        settings.TypeJavaScriptGenerator = n.SelectSingleNode("@type").InnerText;
                    }
                }
                else if (n.Name == "debug")
                {
                    if (n.SelectSingleNode("@enabled") != null && n.SelectSingleNode("@enabled").InnerText == "true")
                        settings.DebugEnabled = true;
                }
                else
#endif
                    if (n.Name == "jsonConverters")
                    {
                        if (n.SelectSingleNode("@includeTypeProperty") != null && n.SelectSingleNode("@includeTypeProperty").InnerText == "true")
                        {
                            settings.IncludeTypeProperty = true;
                        }
                        if (n.SelectSingleNode("@useSimpleObjectNaming") != null && n.SelectSingleNode("@useSimpleObjectNaming").InnerText == "true")
                        {
                            settings.UseSimpleObjectNaming = true;
                        }

                        XmlNodeList jsonConverters = n.SelectNodes("add");

                        foreach (XmlNode j in jsonConverters)
                        {
                            XmlNode t = j.SelectSingleNode("@type");

                            if (t == null)
                                continue;

                            Type type = Type.GetType(t.InnerText);

                            if (type == null)
                            {
                                // throw new ArgumentException("Could not find type " + t.InnerText + ".");
                                continue;
                            }

                            if (!typeof(JavaScriptConverter).IsAssignableFrom(type))
                            {
                                // throw new ArgumentException("Type " + t.InnerText + " does not inherit from JavaScriptObjectConverter.");
                                continue;
                            }

                            StringDictionary d = new StringDictionary();
                            foreach (XmlAttribute a in j.Attributes)
                            {
                                if (d.ContainsKey(a.Name)) continue;
                                d.Add(a.Name, a.Value);
                            }

                            JavaScriptConverter c = (JavaScriptConverter)Activator.CreateInstance(type);
                            c.Initialize(d);

                            Utility.AddConverter(settings, c, true);
                        }


                        jsonConverters = n.SelectNodes("remove");

                        foreach (XmlNode j in jsonConverters)
                        {
                            XmlNode t = j.SelectSingleNode("@type");

                            if (t == null)
                                continue;

                            Type type = Type.GetType(t.InnerText);

                            if (type == null)
                            {
                                // throw new ArgumentException("Could not find type " + t.InnerText + ".");
                                continue;
                            }

                            Utility.RemoveConverter(settings, type);
                        }
                    }
			}

			return settings;
		}