I am having trouble with adding the required text to the web.config file for the HtmlAgilityPackSanitizerProvider.
Even when I open the sample site from the toolkit in Visual Web Developer I get an error. The element 'system.web' has an invalid child element 'sanitizer'. Not sure how to get this to work.
This is the section of the toolkit sample site: <configuration> <configSections> <sectionGroup name="system.web"> <section name="sanitizer" requirePermission="false" type="AjaxControlToolkit.Sanitizer.ProviderSanitizerSection, AjaxControlToolkit" /> </sectionGroup> </configSections> <appSettings/> <connectionStrings/> <system.web> <trust level="Full" /> <sanitizer defaultProvider="HtmlAgilityPackSanitizerProvider"> <providers> <add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider"></add> </providers> </sanitizer>
I am also having this exact problem along with TonyLoco23 (on another post). This question is asked a lot in forums, but I have never found it answered.
The whole error is:
Warning 1 The element 'system.web' has invalid child element 'sanitizer'. List of possible elements expected: 'anonymousIdentification, authentication, authorization, browserCaps, clientTarget, compilation, customErrors, deployment, deviceFilters, fullTrustAssemblies,
globalization, healthMonitoring, hostingEnvironment, httpCookies, httpHandlers, httpModules, httpRuntime, identity, machineKey, membership, mobileControls, pages, partialTrustVisibleAssemblies, processModel, profile, roleManager, securityPolicy, sessionPageState,
sessionState, siteMap, trace, trust, urlMappings, webControls, webParts, webServices, xhtmlConformance, caching'. http://localhost/web.config 11 6
And, as far as I can see, the people asking the questions post clean code that is easy to read, and the people attempting to answer them post cryptic code like they do not know how to cut and paste without the <div> garbage.
So far, I have built three different virtual machines (windows 7 on my work laptop, windows 7 on my home computer, windows server 2k8 r2 on my home computer) and I get the same exact issue every time whether it is HtmlAgilityPackSanitizerProvider or AntiXssSanitizerProvider.
That, and the fact that this question gets asked a lot, tells me that there might either be some new 'bug' or some assumed configuration change that old developers automatically know and new asp.net developers do not.
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.
It is not my config file, it is the sample one provided with the toolkit.
The sectionGroup part goes in the the configuration section and works OK. It is the sanitizer part that is the problem. It does not work in system.web and as a new asp.net coder I and apparently a lot of others have no idea where to put the
I used NuGet to add the HtmlAgilityPack as you suggested but I STILL get the same error in the web.config file.
Here are the steps to duplicate the error: download the tookit. Unzip the sample web site. Open the web.config file. The sanitizer is marked as an invalid child node in the config file.
I have the same problem. I have HTMLAgilitypack.dll in the Bin folder but when I add the required sections to the config file I get this:
Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized element 'sanitizer'. Source Error:
Line 63: <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
Line 64: <!-- Sanitizes for the HTML Editor Extender -->
Line 65: <sanitizer defaultProvider="HtmlAgilityPackSanitizerProvider"> Line 66: <providers>
Line 67: <add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider"></add>
'system.web' has an invalid child element 'sanitizer'.
Using Visual Studio 12/ .Net 4.5 - I updated AjaxControlToolKit 4.1.60919.0, HtmlAgilityPack 1.4.6.0, SanitizerProviders 1.0.0.0 using GuNET and installing using Package Manager Console. Newest and updated everything.
What else can be done? I hope this thread re-opens.
ProgDev
0 Points
4 Posts
Adding HtmlAgilityPackSanitizerProvider
Aug 08, 2012 04:03 PM|LINK
I am having trouble with adding the required text to the web.config file for the HtmlAgilityPackSanitizerProvider.
Even when I open the sample site from the toolkit in Visual Web Developer I get an error.
ProviderSanitizerSection, AjaxControlToolkit" />itizerProvider">der" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider"></add>
The element 'system.web' has an invalid child element 'sanitizer'.
Not sure how to get this to work.
This is the section of the toolkit sample site:
<configuration>
<configSections>
<sectionGroup name="system.web">
<section name="sanitizer" requirePermission="false"
type="AjaxControlToolkit.Sanitizer.
</sectionGroup>
</configSections>
<appSettings/>
<connectionStrings/>
<system.web>
<trust level="Full" />
<sanitizer defaultProvider="HtmlAgilityPackSan
<providers>
<add name="HtmlAgilityPackSanitizerProvi
</providers>
</sanitizer>
brandon.john...
Member
2 Points
2 Posts
Re: Adding HtmlAgilityPackSanitizerProvider
Aug 08, 2012 07:35 PM|LINK
I am also having this exact problem along with TonyLoco23 (on another post). This question is asked a lot in forums, but I have never found it answered.
The whole error is:
Warning 1 The element 'system.web' has invalid child element 'sanitizer'. List of possible elements expected: 'anonymousIdentification, authentication, authorization, browserCaps, clientTarget, compilation, customErrors, deployment, deviceFilters, fullTrustAssemblies, globalization, healthMonitoring, hostingEnvironment, httpCookies, httpHandlers, httpModules, httpRuntime, identity, machineKey, membership, mobileControls, pages, partialTrustVisibleAssemblies, processModel, profile, roleManager, securityPolicy, sessionPageState, sessionState, siteMap, trace, trust, urlMappings, webControls, webParts, webServices, xhtmlConformance, caching'. http://localhost/web.config 11 6
And, as far as I can see, the people asking the questions post clean code that is easy to read, and the people attempting to answer them post cryptic code like they do not know how to cut and paste without the <div> garbage.
Here is another thread with the same issue that goes unanswered: http://forums.asp.net/t/1739306.aspx/1
So far, I have built three different virtual machines (windows 7 on my work laptop, windows 7 on my home computer, windows server 2k8 r2 on my home computer) and I get the same exact issue every time whether it is HtmlAgilityPackSanitizerProvider or AntiXssSanitizerProvider. That, and the fact that this question gets asked a lot, tells me that there might either be some new 'bug' or some assumed configuration change that old developers automatically know and new asp.net developers do not.
I get this error attempting to follow Stephen Walther's blog post here: http://stephenwalther.com/archive/2011/08/17/adding-the-new-html-editor-extender-to-a-web-forms.aspx
Can this be explained like I am 5?
chetan.sarod...
All-Star
65839 Points
11163 Posts
Re: Adding HtmlAgilityPackSanitizerProvider
Aug 09, 2012 03:12 AM|LINK
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
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
ProgDev
0 Points
4 Posts
Re: Adding HtmlAgilityPackSanitizerProvider
Aug 09, 2012 11:25 AM|LINK
It is not my config file, it is the sample one provided with the toolkit.
The sectionGroup part goes in the the configuration section and works OK. It is the sanitizer part that is the problem. It does not work in system.web and as a new asp.net coder I and apparently a lot of others have no idea where to put the
<sanitizer defaultProvider="AntiXssSanitizerProvider"> <providers> <add name="AntiXssSanitizerProvider" type="AjaxControlToolkit.Sanitizer. AntiXssSanitizerProvider"></add> </providers> </sanitizer>BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: Adding HtmlAgilityPackSanitizerProvider
Aug 10, 2012 03:22 AM|LINK
Hello
This is an existing issue with the toolkit. I see you've created a track at http://ajaxcontroltoolkit.codeplex.com/workitem/27236
For a walkaround, you can also use this library to sanitize the user's input at code behind, http://htmlagilitypack.codeplex.com/releases/view/90925
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
ProgDev
0 Points
4 Posts
Re: Adding HtmlAgilityPackSanitizerProvider
Aug 13, 2012 12:43 PM|LINK
I used NuGet to add the HtmlAgilityPack as you suggested but I STILL get the same error in the web.config file.
Here are the steps to duplicate the error: download the tookit. Unzip the sample web site. Open the web.config file. The sanitizer is marked as an invalid child node in the config file.
Roosker
Member
37 Points
55 Posts
Re: Adding HtmlAgilityPackSanitizerProvider
Nov 29, 2012 04:59 PM|LINK
I have the same problem. I have HTMLAgilitypack.dll in the Bin folder but when I add the required sections to the config file I get this:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized element 'sanitizer'.
Source Error:
Line 63: <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"> Line 64: <!-- Sanitizes for the HTML Editor Extender --> Line 65: <sanitizer defaultProvider="HtmlAgilityPackSanitizerProvider"> Line 66: <providers> Line 67: <add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider"></add>Has this issue been resolved?
enewmen
Member
12 Points
7 Posts
Re: Adding HtmlAgilityPackSanitizerProvider
Jan 21, 2013 09:40 AM|LINK
I have the same issue as well.
<system.web>
<sanitizer defaultProvider="HtmlAgilityPackSanitizerProvider">
<providers> <add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider" /> </providers>
</sanitizer>
'system.web' has an invalid child element 'sanitizer'.
Using Visual Studio 12/ .Net 4.5 - I updated AjaxControlToolKit 4.1.60919.0, HtmlAgilityPack 1.4.6.0, SanitizerProviders 1.0.0.0 using GuNET and installing using Package Manager Console. Newest and updated everything.
What else can be done? I hope this thread re-opens.
thanks!