Thursday 2 August 2012

Sanitizer provider is not configured in the web.config file. If you are using the HtmlEditorExtender with a public website then please configure a Sanitizer provider.


Sanitizer provider is not configured in the web.config file. If you are using the HtmlEditorExtender with a public website then please configure a Sanitizer provider. Otherwise, set the EnableSanitization property to false.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Sanitizer provider is not configured in the web.config file. If you are using the HtmlEditorExtender with a public website then please configure a Sanitizer provider. Otherwise, set the EnableSanitization property to false.




Place the below section just below the openieng of "<configuration>" tag within the file "web.config"


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


Anti-XSS can be easily obtained using NuGet. (Similar to previous post for installing AjaxControl Toolkit)

Visual Studio 2010 --> Tools --> Library Package Manager --> Package Manager Console -->
PM> Install-Package AntiXSS

You will get the below error if Anti-XSS is not installed:

Could not load type 'AjaxControlToolkit.Sanitizer.AntiXssSanitizerProvider'


5 comments:

  1. Muito obrigado, funcionou e me ajudou muito.

    ReplyDelete
    Replies
    1. Used a google translate to understand this ;) But really it feels so good when I find a value for what I post.

      Thanks & good luck!

      Delete
  2. This code is not working on my visual studio 2012

    ReplyDelete
  3. Error is
    Sanitizer provider is not configured in the web.config file. If you are using the HtmlEditorExtender with a public website then please configure a Sanitizer provider. Otherwise, set the EnableSanitization property to false.

    ReplyDelete
    Replies
    1. Thanks Karan for the tip!
      It deserves a try on my next consumption for the Sanitizer Provide.

      Delete