Asp.net主页元标记在< body>之间呈现标签? [英] Asp.net master page meta tags get rendered between <body> tags?

查看:70
本文介绍了Asp.net主页元标记在< body>之间呈现标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白为什么,但我的代码在< head>之间标签在< body>下得到渲染







SiteMaster代码



 <%@     Master    语言  =  C#    AutoEventWireup   =  true   < span class =code-attribute> CodeBehind   =  Site.master.cs   继承  =  GPO.SiteMaster   %>  


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

< head runat = 服务器 >
< meta name =< /跨度> <跨度class =code-keyword> ROBOTS content = 索引,请按照 / >
< meta charset = UTF-8 / < span class =code-keyword>>
< meta http-equiv = content-language conte nt = en-US / >
< meta name = 观众 content = all / >
< meta name = 作者 content = 全球物业在线 / >
< meta name = revisit-after 内容 = 2天 / >
< meta name = viewport content = width = device-width,initial-scale = 1 / >
< meta id = metadesc name = description content = 全球物业在线 - 物业出售或出租房屋,别墅,公寓,别墅,乡村别墅,土地和企业。我们还使用RSS feed解析器系统列出您的属性。 runat = server / >
< meta name = 关键字 内容 = 移动,桌面,自适应属性网站,xml2u,kyero, rss,feed,xml,feed中的属性,来自xml2u,属性feed解析,xml解析,属性,农场,房屋,公寓,属性,土地,别墅待售,商家出售,私有财产,费用ds,RSS feed,转换货币,国际,代理,列表属性 / >

< link href = Content / responsivemobilemenu.css rel = 样式表 类型 = text / css / >
< script type = text / javascript src = Scripts / jquery.min.js > < / script >
< script 类型 = text / javascript src = Scripts / responsivemobilemenu.js > < / script > ;

< asp:ContentPlaceHolder ID = runat = server > < / asp:ContentPlaceHolder >
< link href = Content / Site.css rel = 样式表 类型 = text / css / >
< link rel = 图标 type = image / png href = favicon.png / >
< title > < ; / title >
< style type = text / css >
a {
text-decoration none;
}
< / < span class =code-leadattribute> style
>
< / head >
< body >
< div id = container_l >
< 表格 id = Form1 runat = 服务器 >

< 输入 类型 = hidden name = MyFormSearchVal value = / >
<! - DWLayoutTable - >
< div style = text-align:center;向左飘浮;
padding-left:20px;
>
< img src = / images / GPO.png alt = 徽标 / >

< / div >
< div 样式 = floa t:对; padding-removed 20px; > < asp:标签 ID = lblWelcome runat < span class =code-keyword> = server > < / asp:标签 >
< asp:LinkBut​​ton ID = lnkLogout runat = server OnClick = lnkLogout_Click > < / asp:LinkBut​​ton > < / div >
< div < span class =code-attribute> style = clear:both; < span class =code-keyword>> < / div >
< div class = rmm >
< ; ul >
< li > < a href =' Default.aspx' > 主页< / a > < / li & gt;
< li > < a href =' Register.aspx' > 注册< / a > < / li >
< li < span class =code-keyword>> < a href =' Members.aspx' id = mnuMember > 登录< / a > < / li < span class =code-keyword>>
< li > < a href =' ContactUs.aspx' > 与我们联系< / a > < / li >

< li > < a href =' TermsAndCondition.aspx' > 条款和条件< / a > < / li >
< li > < a < span class =code-attribute> href =' About.aspx' > 关于< / a > < / li >
< / ul >
< / div >
< < span class =code-leadattribute> div
class = 已删除 style = color:white; text-align:center; >
< asp:ContentPlaceHolder runat = 服务器 ID = 默认 >
< / asp:ContentPlaceHolder >
< div 样式 = margin-removed auto ;保证金已删除自动; >
< img src = Images / loader.gif id = imgLoad alt = 正在加载 style = display:none; margin-left:auto; margin-right:auto;宽度:32px;高度:32px; / >
< / div >
< div 样式 = clear:both; > < / div >
< div class = < span class =code-keyword> map >
< a href =' Default.aspx' > 主页< / a > |
< a < span class =code-attribute> href =' Register.aspx' > 注册< / a > | < a href =' ContactUs.aspx' > 与我们联系< / a > | < a href =' TermsAndCondition.aspx ' > 条款< / a > | < a href = Latest.aspx > 最新的1000个属性映射< / a >
< / div >
< / div >



< / form >
< br / >
< br / >


< / div >

< / body >
< / html >



[url removed]

解决方案

查看来源(查看视图 - >来源,而不是通过开发工具),你会看到你的头部不在体内。但是你的html无效,你在html之前渲染ap标签,所以浏览器可能会动态地将DOM重新安排到它认为有效的东西,这就是你在浏览器的开发工具中看到的。

I dont understand why , but my code between <head> tags get render under <body>



SiteMaster code

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="GPO.SiteMaster" %>


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

<head  runat="server"> 
    <meta name="ROBOTS" content="index,follow" />
    <meta charset="UTF-8" />
    <meta http-equiv="content-language" content="en-US" />
    <meta name="audience" content="all" />
    <meta name="Author" content="Global Property Online" />
    <meta name="revisit-after" content="2 days" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta id="metadesc" name="description" content="Global Property Online - Property for sale or rent Houses, Villas, Apartments, Cottages, Country Homes, Land & Businesses. We also list your properties with our RSS feed parser system."  runat="server" />
    <meta name="keywords" content="mobile,desktop,responsive property site,xml2u,kyero,rss,feeds,xml,properties from feeds,from xml2u,property feed parsing,xml parsing,property,farms,houses,apartments,properties,land,villas for sale,businesses for sale,private property,Feeds, RSS feeds, convert currency,international,agent, list properties" />
  
    <link href="Content/responsivemobilemenu.css" rel="Stylesheet" type="text/css" />
    <script type="text/javascript" src="Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="Scripts/responsivemobilemenu.js"></script>
  
    <asp:ContentPlaceHolder ID="Head" runat="server"></asp:ContentPlaceHolder>
    <link href="Content/Site.css" rel="Stylesheet" type="text/css" />
    <link rel="icon" type="image/png" href="favicon.png" />
    <title></title>
    <style type="text/css">
        a {
            text-decoration: none;
        }
    </style>
</head>
<body>
<div id="container_l">
    <form id="Form1"  runat="server">
        
            <input type="hidden" name="MyFormSearchVal" value="yes" />
            <!--DWLayoutTable-->
            <div style="text-align: center;     float: left;
    padding-left: 20px;">
                <img src="/images/GPO.png" alt="Logo" />
               
            </div> 
        <div style="float: right; padding-removed 20px;"><asp:Label ID="lblWelcome" runat="server"></asp:Label>
                <asp:LinkButton ID="lnkLogout" runat="server" OnClick="lnkLogout_Click"></asp:LinkButton></div>
      <div style="clear:both;"></div>
            <div class="rmm">
                <ul>
                    <li><a href='Default.aspx'>Home</a></li>
                    <li><a href='Register.aspx'>Register</a></li>
                    <li><a href='Members.aspx' id="mnuMember" >Login</a></li>
                    <li><a href='ContactUs.aspx'>Contact Us</a></li>

                    <li><a href='TermsAndCondition.aspx'>Terms and Conditions</a></li>
                     <li><a href='About.aspx'>About</a></li>
                </ul>
            </div>
            <div class="removed" style="color: white; text-align: center;">
                <asp:ContentPlaceHolder runat="server" ID="Default">
                </asp:ContentPlaceHolder>
                <div style="margin-removed auto; margin-removed auto;">
                    <img src="Images/loader.gif" id="imgLoad" alt="Loading" style="display: none; margin-left: auto; margin-right: auto; width: 32px; height: 32px;" />
                </div>  
                <div style="clear:both;"></div>
                <div class="map">
                <a href='Default.aspx'>Home</a> | 
               <a href='Register.aspx'>Register</a> | <a href='ContactUs.aspx'>Contact Us</a> |<a href='TermsAndCondition.aspx'>Terms and Conditions</a> | <a href="Latest.aspx">Lastest 1000 property map</a>
            </div>
            </div>
          

        
    </form>
    <br />
    <br />


</div>

</body>
</html>


[url removed]

解决方案

View the source (view view->source, not via the dev tools) and you'll see your head is not inside the body. However your html is invalid, you are rendering a p tag before the html so the browser is probably re-arranging the DOM on the fly to something it thinks is valid, and that is what you're seeing in the browser's dev tools.


这篇关于Asp.net主页元标记在&lt; body&gt;之间呈现标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆