【问题标题】:.aspx code errors "Element 'xxxx' is not supported.".aspx 代码错误“不支持元素‘xxxx’。”
【发布时间】:2011-12-31 10:49:48
【问题描述】:

我的图像按钮、链接按钮、文本框和标签出现大量此类错误。这些错误在我的 .aspx 代码中。为什么我得到这么多?

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="frmSearchPersonnel.aspx.cs" Inherits="frmSearchPersonnel" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head id="Head1" runat="server"> 
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 

    <div align="center"> 


    </div> 

    </div> 
    <asp:Label ID="Label1" runat="server" Text="Search for employee by last name"></asp:Label> 
    <asp:TextBox ID="txtSearchName" runat="server"></asp:TextBox> 
    <p> 
        <asp:Button ID="btnSearch" runat="server" PostBackUrl="~/frmViewPersonnel.aspx"  
            Text="Search" onclick="btnSearch_Click" /> 
    </p> 
    </form> 
</body> 
</html>.

错误位于上方的蓝色标签、文本框和按钮下。错误状态:

验证():不支持元素“xxxx”。

【问题讨论】:

  • 你能给我们错误文本和行号吗?
  • @Rup:错误位于上方的蓝色标签、文本框和按钮下方。错误状态 Validation (): Element 'xxxx' is not supported.
  • 您是否尝试在 Visual Studio 中关闭文件并重新打开它,看看错误是否消失?似乎记得有时在新创建的文件上会发生这种情况。
  • 我最好的猜测是你不知何故丢失了 asp: 命名空间定义。您还没有在 web.config 中的 &lt;pages&gt;&lt;controls&gt; 中创建 &lt;clear/&gt;
  • @DoozerBlake:是的,我试过了。

标签: c# asp.net


【解决方案1】:

我和我的 Resharper 看到的唯一问题是结束 html 标记之后的句点。

</html>.

你遇到了什么错误?

编辑:

这里有一个简单的解决方法:

http://weblogs.asp.net/alaaalnajjar/archive/2010/08/31/how-to-fix-quot-validation-element-xxxx-is-not-supported-quot-visual-studio-2010.aspx

想法是从路径中删除文件夹“ReflectedSchemas”:

Win XP : C:\Documents and Settings{用户名}\Application 数据\Microsoft\VisualStudio\10.0\ReflectedSchemas

Win Vista / 7:C:\Users\AppData\Roaming \Microsoft\VisualStudio\10.0\ReflectedSchemas

注意:确保“显示隐藏的文件、文件夹和驱动器”是 从文件夹选项中选择,也不要忘记关闭VS之前 删除文件夹。

这个解决方案应该适用于 VS2010 和 VS2008,在 VS2008 你必须 从文件夹 9.0 而不是 10.0 中删除 ReflectedSchemas。

【讨论】:

  • 这应该不会导致编译错误——就 ASP.NET 而言,这只是发送到 HTML 页面中的额外文本。但是,是的,我没有看到任何明显的东西。
  • @Ed B: 错误状态 Validation (): Element 'xxxx' is not supported.
  • 试试我上面添加的这个修复..看起来很简单
  • 谢谢它的工作。对于 Windows 7 + vs 2010 我面临同样的问题。现在解决。
【解决方案2】:

这个问题之前已经报告过了。我找到了一篇有解决步骤的文章:

  1. 关闭 Visual Studio 2008(或 Visual Studio 2010)。
  2. 进入控制面板 -> 外观和个性化 -> 文件夹选项 -> 然后选择查看选项卡。现在确保“显示隐藏 文件、文件夹和驱动器”已选中,然后单击“确定”。
  3. 现在浏览到以下文件夹:计算机 -> 操作系统 (C:) -> 用户 -> {用户名} -> AppData -> 漫游 -> Microsoft -> VisualStudio -> 9.0 文件夹。注意:在 Visual Studio 2010 中为 10.0 文件夹。
  4. 现在删除“ReflectedSchemes”文件夹。这应该修复 ASP.NET 服务器的“验证():不支持元素''”错误 Visual Studio 2008 中的控件。
  5. 重新打开 Visual Studio 2008 项目后,您现在应该可以让 ASP.NET 服务器控件的智能感知正常工作。

更多详情请看这里:
http://www.gotknowhow.com/articles/fix-validation-element-not-supported-visual-studio-2010

【讨论】:

  • 我正在通过 Citrix 工作。我认为我无权访问该文件夹。
  • 您应该这样做 - 它在您的个人资料中。如果看不到目录,请尝试输入路径,因为那里会有隐藏文件夹。如果您使用的是 Vista 之前的系统,请查找 \Documents and Settings\Mike\Application Data\Microsoft\VisualStudio\10.0 等。
  • 嘿thanx 在 Windows 7 + vs 2010 上为我工作..不错的工作
【解决方案3】:

将此添加到您的页面中。

  <!DOCTYPE html>

  <html lang="en">

代替

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 

【讨论】:

    【解决方案4】:

    希望能帮助像我这样的 google 搜索中的其他人:

    Visual Studio 2013 - 我按照其他人的建议做了同样的事情,删除“ReflectedSchemes”文件夹无济于事。

    最后,我删除了&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; - 然后替换它,问题突然消失了。仔细想想,我好像也做过。

    FWIW....

    【讨论】:

      【解决方案5】:

      注意到我必须删除 ReflectedSchemas 的内容:

      %AppData%\Roaming\Microsoft\VisualStudio\9.0\ReflectedSchemas\

      %AppData%\Roaming\Microsoft\VisualStudio\10.0\ReflectedSchemas\

      也跟着重置了VS2010设置:

      https://msdn.microsoft.com/en-us/library/ms247075(v=VS.100).aspx

      让它解决问题。

      【讨论】:

        【解决方案6】:

        对于那些无法删除“ReflectedSchemas”文件夹的人 - 请执行以下操作

        • 关闭 Visual Studio
        • 再次尝试删除(Windows 7 路径):
        C:\Users\DefaultAppPool\AppData\Roaming\Microsoft\VisualStudio\ReflectedSchemas C:\Users\Classic .NET AppPool\AppData\Roaming\Microsoft\VisualStudio\ReflectedSchemas C:\Users\Classic .NET AppPool\AppData\Local\Microsoft\VisualStudio\ReflectedSchemas C:\Users\[your_nt_name]\AppData\Local\Microsoft\VisualStudio\ReflectedSchemas C:\Users\[your_nt_name]\AppData\Roaming\Microsoft\VisualStudio\ReflectedSchemas
        • 对我来说上面没有用,所以我只是复制了整个文件夹

        用户[your_nt_name]\AppData\Roaming\Microsoft\VisualStudio

        来自没有发生这些问题的另一台机器。在此之后,所有 ASP.net IntelliSence 问题都消失了。

        我保留了 VistualStudio 文件夹的压缩备份,以防再次发生这种情况。

        【讨论】:

          【解决方案7】:

          将目标验证更改为“HTML 5”并单击确定,Element 是支持 HTML 5 的验证,因此 XHTML1.0 不支持它

          参考下面的截图Set Vadation to HTML5

          【讨论】:

            猜你喜欢
            • 2018-07-05
            • 1970-01-01
            • 1970-01-01
            • 2022-08-20
            • 2017-03-31
            • 1970-01-01
            • 2020-11-27
            • 2018-11-09
            • 2018-10-04
            相关资源
            最近更新 更多