Could not load type AjaxControlToolkit.Sanitizer.A

2019-08-03 18:29发布

问题:

I want to use the htmleditorextender for my asp website, this is what I have in my .aspx file:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
<asp:TextBox ID="txtContent" runat="server" Width="400px" Heigh="400px" />
<asp:HtmlEditorExtender ID="hex" runat="server" TargetControlID="txtContent">
</asp:HtmlEditorExtender>

My web.conf settings are:

<configuration>
  <configSections>
    <sectionGroup name="system.web">
      <section name="sanitizer" requirePermission="false"
               type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, AjaxControlToolkit" />
    </sectionGroup>
  </configSections>

  <system.web>

    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.0"/>

    <sanitizer defaultProvider="HtmlAgilityPackSanitizerProvider">
      <providers>
        <add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider"></add>
      </providers>
    </sanitizer>


  </system.web>
</configuration>

I installed also the HtmlAgilityPack (tried the lastest version, and version 1.4).

But still getting this error:

Could not load type 'AjaxControlToolkit.Sanitizer.AntiXssSanitizerProvider'.

Also tried it with adding the AntiXSSLibrary.dll and SanitizerProviders.dll, but still doesn't work (don't know if they're needed).

What am I doing wrong?

I tried this also: Could not load type 'AjaxControlToolkit.Sanitizer.AntiXssSanitizerProvider'.