简体   繁体   English

ASP.NET:第 1 行第 2 列出错:StartTag:元素名称无效

[英]ASP.NET: error on line 1 at column 2: StartTag: invalid element name

I'm trying to deploy a local webpage and I'm getting this error.我正在尝试部署本地网页,但出现此错误。 I know this is caused by ASP.NET not being installed correctly on my computer, but I'm not sure how to fix that.我知道这是由于 ASP.NET 未正确安装在我的计算机上引起的,但我不知道如何解决。 I've been looking up answers on Google and here, and most of them are from 5-12 years ago.我一直在谷歌和这里寻找答案,其中大部分来自 5-12 年前。 In any case, the solutions I've tried haven't worked.无论如何,我尝试过的解决方案都没有奏效。

I've tried installing ASP.NET from the Command Prompt and turning on the ASP.NET features through appwiz.cpl.我尝试从命令提示符安装 ASP.NET 并通过 appwiz.cpl 打开 ASP.NET 功能。 All the other solutions are old and don't seem to apply to now.所有其他解决方案都是旧的,现在似乎并不适用。

Here is the code:这是代码:

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .auto-style3 {
            width: 100%;
            height: 593px;
        }
        .auto-style4 {
            height: 476px;
        }
    </style>
</head>
<body>
    <form id="Homepage" runat="server">
        <div>
        </div>
        <table class="auto-style3">
            <tr>
                <td class="auto-style4">
                    <asp:HyperLink ID="hlnkEntertain" runat="server" ImageUrl="~/entertain.png" ImageWidth="100%" NavigateUrl="~/Default2.aspx">HyperLink</asp:HyperLink>
                </td>
                <td class="auto-style4">
                    <asp:HyperLink ID="hlnkTools" runat="server" ImageUrl="~/tools.png" ImageWidth="100%">HyperLink</asp:HyperLink>
                </td>
                <td class="auto-style4">
                    <asp:HyperLink ID="hlnkTeaching" runat="server" ImageUrl="~/teaching.png" ImageWidth="100%">HyperLink</asp:HyperLink>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;</td>
                <td>
                    <asp:HyperLink ID="hlnkMyLMS" runat="server" ImageUrl="~/Filled Ranged Colour@4x.png" ImageWidth="100%" NavigateUrl="https://mylmsft.institution.africa/my/">HyperLink</asp:HyperLink>
                </td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
    </form>
</body>
</html>

change your starting line of page from更改页面的起始行

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

to:至:

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

remove under score from beginning of page name inside Inherits tag从 Inherits 标记内页面名称的开头删除分数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM