Installing AjaxToolKit Error: Parser Error Message: Unrecognized element 'sanitizer'.

Hello,

New to AJAX – I’m trying to use the CascadingDropdown.  The AJAXToolKit is downloaded with NuGet.  It’s pulled into the toolbar in VS2010. 

At the top of my page is:

<%@ Page Title="" Language="VB" MasterPageFile="~/Masters/mstrIntranet.master" AutoEventWireup="false" 
     CodeFile="orderAdd.aspx.vb" Inherits="AddOrder" Debug="True" %>
<%@ Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
The page line shows an error "Unrecognized Element Sanitizer"
In the Web.Config is:
<configuration>
    <configSections>
        <sectionGroup name="system.web">
            <section name="sanitizer"
          requirePermission="false"
          type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, 
        AjaxControlToolkit"/>
        </sectionGroup>
    </configSections>
    <appSettings />
 <system.web>
 <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
      </assemblies>
        <sanitizer defaultProvider="AntiXssSanitizerProvider">
            <providers>
                <add name="AntiXssSanitizerProvider" type="AjaxControlToolkit.Sanitizer. 
              AntiXssSanitizerProvider"></add>
            </providers>
        </sanitizer>
    </compilation>
 
This line: <sanitizer defaultProvider="AntiXssSanitizerProvider"> 
Shows an error: "The element compilation has an invalid child element 'sanitizer'."
On the web page is shows an error on the same line: Unrecognized element 'sanitizer'.

Hi, 

jslist

his line: <sanitizer defaultProvider="AntiXssSanitizerProvider"> 
Shows an error: "The element compilation has an invalid child element 'sanitizer'."
On the web page is shows an error on the same line: Unrecognized element 'sanitizer'.

I can’t reproduce this issue locally. Could you check when this configuration above is added in the web.config? As far as I know, when you are using AJAX CascadingDropdown control, this configuration is not needed. In order to resolve your issue, I would
suggest you comment out the corresponding configuration above at first. Then try to add the CascadingDropdown control as follows:

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/CascadingDropDown/CascadingDropDown.aspx

http://www.codeproject.com/Articles/32725/Using-CascadingDropDown-with-a-Database

Best wishes, 

The <system.web> element section group definition isn’t valid because the system web section group uses a type, which means it has an explicit definition.  You can’t include your custom config section in the <system.web>; put it in your own sectionGroup
or at the root level instead.  You don’t need to define a sectionGroup type, but can just simply use a name to group your custom sections.

http://forums.asp.net/t/1739306.aspx/1

http://forums.asp.net/t/1831845.aspx/1?Adding+HtmlAgilityPackSanitizerProvider

Leave a Reply