亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Verzeichnis suchen
ASP.NET 基礎教程 ASP.NET 教程 Web Pages - 教程 Web Pages - 添加 Razor 代碼 Web Pages - 頁面布局 Web Pages - 文件夾 Web Pages - 全局頁面 Web Pages - HTML 表單 Web Pages - 對象 Web Pages - 文件 Web Pages - 幫助器 Web Pages - WebGrid 幫助器 Web Pages - Chart 幫助器 Web Pages - WebMail 幫助器 Web Pages - PHP Web Pages - 發(fā)布網(wǎng)站 Razor - 標記 Web Pages - Database 對象 ASP.NET MVC Web Forms - 教程 Web Forms - HTML 頁面 Web Forms - 服務器控件 Web Forms - 事件 Web Forms - HTML 表單 Web Forms - 維持 ViewState Web Forms - TextBox 控件 Web Forms - Button 控件 Web Forms - 數(shù)據(jù)綁定 Web Forms - ArrayList 對象 Web Forms - Hashtable 對象 Web Forms - SortedList 對象 Web Forms - XML 文件 Web Forms - Repeater 控件 Web Forms - DataList 控件 Web Forms - 數(shù)據(jù)庫連接 Web Forms - 母版頁 Web Forms - 導航 ASP.NET Razor Razor - C# 和 VB 代碼語法 Razor - C# 變量 Razor - C# 循環(huán)和數(shù)組 Razor - C# 邏輯條件 Razor - VB 變量 Razor - VB 循環(huán)和數(shù)組 Razor - VB 邏輯條件 WF 參考手冊 Web Forms - HTML 服務器控件 ASP.NET HtmlAnchor 控件 ASP.NET HtmlButton 控件 ASP.NET HtmlForm 控件 ASP.NET HtmlGeneric 控件 ASP.NET HtmlImage 控件 ASP.NET HtmlInputButton 控件 ASP.NET HtmlInputCheckBox 控件 ASP.NET HtmlInputFile 控件 ASP.NET HtmlInputHidden 控件 ASP.NET HtmlInputImage 控件 ASP.NET HtmlInputRadioButton 控件 ASP.NET HtmlInputText 控件 ASP.NET HtmlSelect Control ASP.NET HtmlTable 控件 ASP.NET HtmlTableCell 控件 ASP.NET HtmlTableRow 控件 ASP.NET HtmlTextArea 控件 ASP.NET AdRotator 控件 ASP.NET AdRotator AdvertisementFile 屬性 ASP.NET AdRotator Target 屬性 ASP.NET Button 控件 ASP.NET Button CausesValidation 屬性 ASP.NET Button OnClientClick 屬性 ASP.NET Button PostBackUrl 屬性 ASP.NET Button Text 屬性 ASP.NET Button UseSubmitBehavior 屬性 ASP.NET Button ValidationGroup 屬性 ASP.NET Calendar 控件 ASP.NET Calendar Caption 屬性 ASP.NET Calendar CaptionAlign 屬性 ASP.NET Calendar CellPadding 屬性 ASP.NET Calendar CellSpacing 屬性 ASP.NET Calendar DayHeaderStyle 屬性 ASP.NET Style 控件 ASP.NET BackColor 屬性 ASP.NET BorderColor 屬性 ASP.NET BorderStyle 屬性 ASP.NET BorderWidth 屬性 ASP.NET CssClass 屬性 ASP.NET Font 屬性 ASP.NET ForeColor 屬性 ASP.NET Height 屬性 ASP.NET Width 屬性 ASP.NET Calendar DayNameFormat 屬性 ASP.NET Calendar DayStyle 屬性 ASP.NET Calendar FirstDayOfWeek 屬性 ASP.NET Calendar NextMonthText 屬性 ASP.NET Calendar NextPrevFormat 屬性 ASP.NET Calendar NextPrevStyle 屬性 ASP.NET Calendar OtherMonthDayStyle 屬性 ASP.NET Calendar PrevMonthText 屬性 ASP.NET Calendar SelectedDate 屬性 ASP.NET Calendar SelectedDates 屬性 ASP.NET Calendar SelectedDayStyle 屬性 ASP.NET Calendar SelectionMode 屬性 ASP.NET Calendar SelectMonthText 屬性 ASP.NET Calendar SelectorStyle 屬性 ASP.NET Calendar SelectWeekText 屬性 ASP.NET Calendar ShowDayHeader 屬性 ASP.NET Calendar ShowGridLines 屬性 ASP.NET Calendar ShowNextPrevMonth 屬性 ASP.NET Calendar ShowTitle 屬性 ASP.NET Calendar TitleFormat 屬性 ASP.NET Calendar TitleStyle 屬性 ASP.NET Calendar TodayDayStyle 屬性 ASP.NET Calendar TodaysDate 屬性 ASP.NET Calendar VisibleDate 屬性 ASP.NET Calendar WeekendDayStyle 屬性 ASP.NET CalendarDay 控件 ASP.NET CalendarDay Date 屬性 ASP.NET CalendarDay DayNumberText 屬性 ASP.NET CalendarDay IsOtherMonth 屬性 ASP.NET CalendarDay IsSelectable 屬性 ASP.NET CalendarDay IsSelected 屬性 ASP.NET CalendarDay IsToday 屬性 ASP.NET CalendarDay IsWeekend 屬性 ASP.NET CheckBox 控件 ASP.NET CheckBox Checked 屬性 ASP.NET CheckBox Text 屬性 ASP.NET CheckBox TextAlign 屬性 ASP.NET CheckBoxList 控件 ASP.NET CheckBoxList CellPadding 屬性 ASP.NET CheckBoxList CellSpacing 屬性 ASP.NET CheckBoxList RepeatColumns 屬性 ASP.NET CheckBoxList RepeatDirection 屬性 ASP.NET CheckBoxList RepeatLayout 屬性 ASP.NET CheckBoxList TextAlign 屬性 ASP.NET DropDownList 控件 ASP.NET DropDownList SelectedIndex 屬性 ASP.NET HyperLink 控件 ASP.NET HyperLink ImageUrl 屬性 ASP.NET HyperLink NavigateUrl 屬性 ASP.NET HyperLink Target 屬性 ASP.NET HyperLink Text 屬性 ASP.NET Image 控件 ASP.NET Image AlternateText 屬性 ASP.NET Image ImageAlign 屬性 ASP.NET Image ImageUrl 屬性 ASP.NET ImageButton 控件 ASP.NET ImageButton CausesValidation 屬性 ASP.NET ImageButton ValidationGroup 屬性 ASP.NET ImageButton PostBackUrl 屬性 ASP.NET ImageButton ValidationGroup 屬性 ASP.NET Label 控件 ASP.NET LinkButton 控件 ASP.NET LinkButton OnClientClick 屬性 ASP.NET LinkButton PostBackUrl 屬性 ASP.NET LinkButton Text 屬性 ASP.NET LinkButton ValidationGroup 屬性 ASP.NET ListBox 控件 ASP.NET Rows 屬性 ASP.NET SelectionMode 屬性 ASP.NET ListItem 控件 ASP.NET ListItem Enabled 屬性 ASP.NET ListItem Selected 屬性 ASP.NET ListItem Text 屬性 ASP.NET ListItem Value 屬性 ASP.NET Literal 控件 ASP.NET Literal Text 屬性 ASP.NET Panel 控件 ASP.NET Panel BackImageUrl 屬性 ASP.NET Panel DefaultButton 屬性 ASP.NET Panel Direction 屬性 ASP.NET Panel GroupingText 屬性 ASP.NET Panel HorizontalAlign 屬性 ASP.NET Panel ScrollBars 屬性 ASP.NET Panel Wrap 屬性 ASP.NET PlaceHolder 控件 ASP.NET RadioButton 控件 ASP.NET RadioButtonList 控件 ASP.NET RadioButtonList CellPadding 屬性 ASP.NET RadioButtonList CellSpacing 屬性 ASP.NET RadioButtonList RepeatColumns 屬性 ASP.NET RadioButtonList RepeatDirection 屬性 ASP.NET RadioButtonList TextAlign 屬性 ASP.NET BulletedList BulletImageUrl 屬性 Web Forms - Web 服務器控件 ASP.NET Table 控件 ASP.NET BackImageUrl 屬性 ASP.NET Caption 屬性 ASP.NET CaptionAlign 屬性 ASP.NET CellPadding 屬性 ASP.NET CellSpacing 屬性 ASP.NET GridLines 屬性 ASP.NET HorizontalAlign 屬性 ASP.NET TableCell 控件 ASP.NET TableCell ColumnSpan 屬性 ASP.NET TableCell HorizontalAlign 屬性 ASP.NET TableCell RowSpan 屬性 ASP.NET TableCell Text 屬性 ASP.NET TableCell Wrap 屬性 ASP.NET TableRow 控件 ASP.NET TableRow HorizontalAlign 屬性 ASP.NET TableRow TableSection 屬性 ASP.NET TableRow VerticalAlign 屬性 ASP.NET TextBox 控件 ASP.NET TextBox AutoCompleteType 屬性 ASP.NET TextBox AutoPostBack 屬性 ASP.NET TextBox Columns 屬性 ASP.NET TextBox MaxLength 屬性 ASP.NET TextBox ReadOnly 屬性 ASP.NET TextBox Rows 屬性 ASP.NET TextBox Text 屬性 ASP.NET TextBox TextMode 屬性 ASP.NET TextBox Wrap 屬性 ASP.NET XML 控件 ASP.NET XML DocumentSource 屬性 Web Forms - Validation 服務器控件 ASP.NET CompareValidator 控件 ASP.NET CustomValidator 控件 ASP.NET RangeValidator 控件 ASP.NET RegularExpressionValidator 控件 ASP.NET RequiredFieldValidator 控件 ASP.NET ValidationSummary 控件 ASP.NET BulletedList 控件 ASP.NET BulletedList BulletStyle 屬性 ASP.NET BulletedList DisplayMode 屬性 ASP.NET BulletedList FirstBulletNumber 屬性 ASP.NET BulletedList Target 屬性 WP 參考手冊 Web Pages - 類 Web Pages - WebSecurity 對象 WebSecurity 屬性 - CurrentUserId WebSecurity 屬性 -?CurrentUserName WebSecurity 屬性 - HasUserId WebSecurity 屬性 - IsAuthenticated WebSecurity - ChangePassword() WebSecurity - ConfirmAccount() WebSecurity - CreateAccount() WebSecurity - CreateUserAndAccount() WebSecurity - GeneratePasswordResetToken() WebSecurity - GetCreateDate() WebSecurity - GetPasswordChangeDate() WebSecurity - GetUserId() WebSecurity - InitializeDatabaseConnection() WebSecurity - IsConfirmed() WebSecurity - IsCurrentUser() WebSecurity - Login() WebSecurity - Logout() WebSecurity - RequireAuthenticatedUser() WebSecurity - RequireRoles() WebSecurity - RequireUser() WebSecurity - ResetPassword() WebSecurity - UserExists() Web Pages - WebMail 對象 Web Pages - 更多幫助器
Figuren

Web Pages - 頁面布局



通過 Web Pages ,創(chuàng)建一個布局一致的網(wǎng)站是很容易的事。


一致的外觀

在因特網(wǎng)上,您會發(fā)現(xiàn)很過網(wǎng)站都具有一致的外觀和風格:

  • 每個頁面有相同的頭部
  • 每個頁面有相同的底部
  • 每個頁面有相同的樣式和布局

通過 Web Pages ,您能非常高效地做到這點。您可以把重復使用的內(nèi)容塊(比如頁面頭部和底部)寫在一個單獨的文件中。

您還可以使用布局模板(布局文件)為站點的所有網(wǎng)頁定義一致的布局。


Content Blocks(內(nèi)容塊)

許多網(wǎng)站都有一些內(nèi)容是被顯示在站點的每個頁面中(比如頁面頭部和底部)。

通過 Web Pages,您可以使用 @RenderPage() 方法從不同的文件導入內(nèi)容。

內(nèi)容塊(來自另一個文件)能被導入網(wǎng)頁中的任何地方。內(nèi)容塊可以包含文本,標記和代碼,就像任何普通的網(wǎng)頁一樣。

將共同的頭部和底部寫成單獨的文件,這樣會幫您節(jié)省大量的工作。您不必在每個頁面中書寫相同的內(nèi)容,當內(nèi)容有變動時,您只要修改頭部或者底部文件,就可以看到站點中的每個頁面的相應內(nèi)容都已更新。

以下顯示了它在代碼中是如何呈現(xiàn)的:

實例

<html>
<body>
@RenderPage("header.cshtml")
<h1>Hello Web Pages</h1>
<p>This is a paragraph</p>
@RenderPage("footer.cshtml")
</body>
</html>
?

Layout Page(布局頁)

在上一部分,您看到了,想在多個網(wǎng)頁中顯示相同內(nèi)容是非常容易的。

另一種創(chuàng)建一致外觀的方法是使用布局頁。一個布局頁包含了網(wǎng)頁的結構,而不是內(nèi)容。當一個網(wǎng)頁(內(nèi)容頁)鏈接到布局頁,它會根據(jù)布局頁(模板)的結構進行顯示。

布局頁中使用 @RenderBody() 方法嵌入內(nèi)容頁,除此之外,它與一個正常的網(wǎng)頁沒有什么差別。

每個內(nèi)容頁都必須以布局指令開始。

以下顯示了它在代碼中是如何呈現(xiàn)的:

布局頁:

<html>
<body>
<p>This is header text</p>
@RenderBody()
<p>&copy; 2012 W3CSchool. All rights reserved.</p>
</body>
</html>

任何網(wǎng)頁:

@{Layout="Layout.cshtml";}

<h1>Welcome to shouce.ren</h1>

<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laborisnisi ut aliquip ex ea commodo consequat.
</p>
?

D.R.Y. - Don't Repeat Yourself(不要自我重復)

通過 Content Blocks(內(nèi)容塊)和 Layout Pages(布局頁)這兩個 ASP.NET 工具,您可以讓您的 Web 應用程序顯示一致的外觀。

這兩個工具能幫您節(jié)省大量的工作,您不必再每個頁面上重復相同的信息。集中的標記、樣式和代碼讓您的 Web 應用程序更易于管理,更易于維護。


防止文件被瀏覽

在 ASP.NET 中,文件的名稱以下劃線開頭,可以防止這些文件在網(wǎng)上被瀏覽。

如果您不想讓您的內(nèi)容塊或者布局頁被您的用戶看到,可以重命名這些文件:

_header.cshtm

_footer.cshtml

_Layout.cshtml


隱藏敏感信息

在 ASP.NET 中,隱藏敏感信息(數(shù)據(jù)庫密碼、電子郵件密碼等等)最通用的方法是將這些信息保存在一個名為"_AppStart"的單獨的文件中。

_AppStart.cshtml

@{
WebMail.SmtpServer = "mailserver.example.com";
WebMail.EnableSsl = true;
WebMail.UserName = "username@example.com";
WebMail.Password = "your-password";
WebMail.From = "your-name-here@example.com";
}



Vorheriger Artikel: N?chster Artikel: