May 12, 2021 ASP.NET
1. ASP.NET Web Pages - Objects
4. Some Page object properties
Web Pages is often about objects.
You've seen some page object methods in use:
In the previous sections, you saw two Page object properties (isPost and Request):
method | describe |
---|---|
href | Create a URL using the specified value. |
RenderBody() | Presenting a part of the content page that is not on the layout page name area. |
RenderPage( page ) | Render the content of a page in another page. |
RenderSection( section ) | Render the content of the layout page named area. |
Write( object ) | Write an object as an HTML encoded string. |
WriteLiteral | Pre-use HTML encoding is preferred when writing objects. |
Attributes | describe |
---|---|
isPost | Returns true if the HTTP data transfer method used by the client is a POST request. |
Layout | Gets or sets the path to the layout page. |
Page | A similar property access to the data shared between the page and the layout page is provided. |
Request | Get httpRequest objects for the current HTTP request. |
Server | Get httpserverutility objects, which provides a web page processing method. |
The Page property of the Page object, which provides access to similar properties for data shared between the page and the layout page.
You can use (add) your own properties to the Page property:
Page properties are very useful. For example, set the page title in a content file and use it in a layout file: