RazorPage Class

Definition

Represents properties and methods that are needed in order to render a view that uses Razor syntax.

public abstract class RazorPage : Microsoft.AspNetCore.Mvc.Razor.RazorPageBase
Inheritance
Derived
Microsoft.AspNetCore.Mvc.Razor.RazorPage<TModel>

Inherited Members

Microsoft.AspNetCore.Mvc.Razor.RazorPageBase

Constructors

RazorPage()

Properties

BodyContent
Context

An HttpContext representing the current request execution.

DiagnosticSource

Gets or sets a System.Diagnostics.DiagnosticSource. instance used to instrument the page execution.

HtmlEncoder

Gets the System.Text.Encodings.Web.HtmlEncoder to use when this RazorPage handles non-IHtmlContent C# expressions.

IsLayoutBeingRendered
Layout
Output

Gets the TextWriter that the page is writing output to.

Path
PreviousSectionWriters
SectionWriters
TempData

Gets the ITempDataDictionary from the ViewContext.

User

Gets the ClaimsPrincipal of the current logged in user.

ViewBag

Gets the dynamic view data dictionary.

ViewContext

Methods

AddHtmlAttributeValue(String, Int32, Object, Int32, Int32, Boolean)
BeginAddHtmlAttributeValues(TagHelperExecutionContext, String, Int32, HtmlAttributeValueStyle)
BeginContext(Int32, Int32, Boolean)
BeginWriteAttribute(String, String, Int32, String, Int32, Int32)
BeginWriteAttributeTo(TextWriter, String, String, Int32, String, Int32, Int32)
BeginWriteTagHelperAttribute()

Starts a new scope for writing ITagHelper attribute values.

CreateTagHelper<TTagHelper>()

Creates and activates a ITagHelper.

DefineSection(String, RenderAsyncDelegate)

Creates a named content section in the page that can be invoked in a Layout page using RenderSection(String) or RenderSectionAsync(String, Boolean).

EndAddHtmlAttributeValues(TagHelperExecutionContext)
EndContext()
EndTagHelperWritingScope()

Ends the current writing scope that was started by calling StartTagHelperWritingScope(HtmlEncoder).

EndWriteAttribute()
EndWriteAttributeTo(TextWriter)
EndWriteTagHelperAttribute()

Ends the current writing scope that was started by calling BeginWriteTagHelperAttribute().

EnsureRenderedBodyOrSections()
ExecuteAsync()
FlushAsync()

Invokes FlushAsync() on Output and Stream.FlushAsync on the response stream, writing out any buffered content to the Body.

Href(String)
IgnoreBody()

In a Razor layout page, ignores rendering the portion of a content page that is not within a named section.

IgnoreSection(String)

In layout pages, ignores rendering the content of the section named sectionName.

InvalidTagHelperIndexerAssignment(String, String, String)

Format an error message about using an indexer when the tag helper property is null.

IsSectionDefined(String)

Returns a value that indicates whether the specified section is defined in the content page.

RenderBody()

In a Razor layout page, renders the portion of a content page that is not within a named section.

RenderSection(String)

In layout pages, renders the content of the section named name.

RenderSection(String, Boolean)

In layout pages, renders the content of the section named name.

RenderSectionAsync(String)

In layout pages, asynchronously renders the content of the section named name.

RenderSectionAsync(String, Boolean)

In layout pages, asynchronously renders the content of the section named name.

SetAntiforgeryCookieAndHeader()

Sets antiforgery cookie and X-Frame-Options header on the response.

StartTagHelperWritingScope(HtmlEncoder)

Starts a new writing scope and optionally overrides HtmlEncoder within that scope.

Write(Object)

Writes the specified value with HTML encoding to Output.

WriteAttributeValue(String, Int32, Object, Int32, Int32, Boolean)
WriteAttributeValueTo(TextWriter, String, Int32, Object, Int32, Int32, Boolean)
WriteLiteral(Object)

Writes the specified value without HTML encoding to Output.

WriteLiteralTo(TextWriter, Object)

Writes the specified value without HTML encoding to the writer.

WriteLiteralTo(TextWriter, String)

Writes the specified value without HTML encoding to Output.

WriteTo(TextWriter, Object)

Writes the specified value with HTML encoding to writer.

WriteTo(TextWriter, String)

Writes the specified value with HTML encoding to writer.

WriteTo(TextWriter, HtmlEncoder, Object)

Writes the specified value with HTML encoding to given writer.