-1

我的 web.config 文件有问题。我在我的网站中添加了 html 编辑器,并按照说明配置了 web.config 文件,但出现此错误:

**Parser Error Message:** The type 'AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider' is ambiguous: it could come from assembly 'C:\Users\358676\Documents\Visual Studio 2012\WebSites\TheHubPortal\bin\AjaxControlToolkit.DLL' or from assembly 'C:\Users\358676\Documents\Visual Studio 2012\WebSites\TheHubPortal\bin\SanitizerProviders.DLL'. Please specify the assembly explicitly in the type name.

    Source Error: 



Line 15:     <sanitizer defaultProvider="HtmlAgilityPackSanitizerProvider">
Line 16:       <providers>
**Line 17:         <add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider"></add>**
Line 18:       </providers>
Line 19:     </sanitizer>

这是我的代码:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Admin.aspx.vb" Inherits="AdminPages_Admin" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="asp" %>


<asp:HtmlEditorExtender ID="HtmlEditorExtender1" runat="server" TargetControlID="NewsBodyTextBox" DisplaySourceTab="true">
                                                            <Toolbar>
                                                                <asp:Undo />
                                                                <asp:Redo />
                                                                <asp:Bold />
                                                                <asp:Italic />
                                                                <asp:Underline />
                                                                <asp:StrikeThrough />
                                                                <asp:Subscript />
                                                                <asp:Superscript />
                                                                <asp:JustifyLeft />
                                                                <asp:JustifyCenter />
                                                                <asp:JustifyRight />
                                                                <asp:JustifyFull />
                                                                <asp:InsertOrderedList />
                                                                <asp:InsertUnorderedList />
                                                                <asp:CreateLink />
                                                                <asp:UnLink />
                                                                <asp:RemoveFormat />
                                                                <asp:SelectAll />
                                                                <asp:UnSelect />
                                                                <asp:Delete />
                                                                <asp:Cut />
                                                                <asp:Copy />
                                                                <asp:Paste />
                                                                <asp:BackgroundColorSelector />
                                                                <asp:ForeColorSelector />
                                                                <asp:FontNameSelector />
                                                                <asp:FontSizeSelector />
                                                                <asp:Indent />
                                                                <asp:Outdent />
                                                                <asp:InsertHorizontalRule />
                                                                <asp:HorizontalSeparator />
                                                                <asp:InsertImage />
                                                            </Toolbar>
                                                        </asp:HtmlEditorExtender>

任何帮助将不胜感激。谢谢!

4

1 回答 1

1

您可以使用 Windows Powershell 获取程序集的完全限定名称。来自这个 StackOverflow 答案的来源:

C:\> cd PATH_TO_ASSEMBLY   
C:\PATH_TO_ASSEMBLY>powershell
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.

PS C:\PATH_TO_ASSEMBLY> [System.Reflection.AssemblyName]::GetAssemblyName('System.Data.SQLite.dll').FullName
**System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139**
PS C:\PATH_TO_ASSEMBLY>

从那里你需要用你实际想要使用的程序集的文件名替换'System.Data.SQLite.dll'。取完全限定名称(以 ** 突出显示)并将您的行更改为如下所示:

<add name="HtmlAgilityPackSanitizerProvider" type="AjaxControlToolkit.Sanitizer.HtmlAgilityPackSanitizerProvider, Version=X.X.X.X, Culture=neutral, PublicKeyToken=3d5c5b1a7743"></add> 

当然,使它与您的完全限定名称匹配。之后,您的歧义问题应该会消失。

于 2013-08-22T00:56:28.353 回答