web pages 经常是跟对象有关的。
Page 对象
您已经看到了一些在使用的 Page 对象方法:
@RenderPage("header.cshtml")
@RenderBody()在前面的章节中,您已经看到了两个 Page 对象属性(isPost 和 Request):
If (isPost) {if (Request["Choice"] != null {Page 对象的 Page 属性
Page 对象的 Page 属性,提供了对页面和布局页之间共享的数据的类似属性访问。
您可以对 Page 属性使用(添加)您自己的属性:
Page.Title Page.Version Page.anythingyoulike
页面属性是非常有用的。例如,在内容文件中设置页面标题,并在布局文件中使用:
Home.cshtml
@{
Layout="~/Shared/Layout.cshtml";
Page.Title="Home Page"
}
<h1>Welcome to W3CSchool.cc</h1>
<h2>Web Site Main Ingredients</h2>
<p>A Home Page (Default.cshtml)</p>
<p>A Layout File (Layout.cshtml)</p>
<p>A Style Sheet (Site.css)</p><div class="aritcle_card flexRow">
<div class="artcardd flexRow">
<a class="aritcle_card_img" href="/ai/968" title="AMiner"><img
src="https://www.herecours.com/d/file/efpub/2026/21-21/20260221131203170179.jpg" alt="AMiner" onerror="this.onerror='';this.src='/static/lhimages/moren/morentu.png'" ></a>
<div class="aritcle_card_info flexColumn">
<a href="/ai/968" title="AMiner">AMiner</a>
<p>AMiner——新一代智能型科技情报挖掘与服务系统,能够为你提供查找论文、理解论文、分析论文、写作论文四位一体一站式服务。</p>
</div>
<a href="/ai/968" title="AMiner" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span> </a>
</div>
</div>【相关推荐】
1. ASP.NET免费视频教程
2. 分享ASP.NET学习笔记(1)--WebPages Razor
3. 分享ASP.NET学习笔记(2)--WebPages 介绍
4. 分享ASP.NET学习笔记(3)WebPages 布局
5. 分享ASP.NET学习笔记(4)文件夹
6. 分享ASP.NET学习笔记(5)全局页面 AppStart 和 PageStart
7. 分享ASP.NET学习笔记(6)WebPages 表单
