PageBase 类

定义

Razor 页面的基类。

public ref class PageBase abstract : Microsoft::AspNetCore::Mvc::Razor::RazorPageBase
public abstract class PageBase : Microsoft.AspNetCore.Mvc.Razor.RazorPageBase
type PageBase = class
    inherit RazorPageBase
Public MustInherit Class PageBase
Inherits RazorPageBase
继承
派生

构造函数

PageBase()

Razor 页面的基类。

属性

BodyContent

获取或设置正文内容。

(继承自 RazorPageBase)
DiagnosticSource

获取或设置 DiagnosticSource 用于检测页面执行的实例。

(继承自 RazorPageBase)
HtmlEncoder

HtmlEncoder获取在处理RazorPageIHtmlContent C# 表达式时要使用的 。

(继承自 RazorPageBase)
HttpContext

获取 HttpContext

IsLayoutBeingRendered

获取或设置一个标志,该标志确定是否要呈现此页面的布局。

(继承自 RazorPageBase)
Layout

获取或设置布局页的路径。

(继承自 RazorPageBase)
MetadataProvider

获取或设置 IModelMetadataProvider

ModelState

获取 ModelStateDictionary

Output

获取 TextWriter 页面要向其写入输出的 。

(继承自 RazorPageBase)
PageContext

PageContext

Path

获取页面的应用程序基相对路径。

(继承自 RazorPageBase)
PreviousSectionWriters

获取或设置此页可以呈现的部分。

(继承自 RazorPageBase)
Request

获取 HttpRequest

Response

获取 HttpResponse

RouteData

RouteData获取执行操作的 。

SectionWriters

获取此页定义的部分。

(继承自 RazorPageBase)
TempData

ITempDataDictionaryViewContext获取 。

(继承自 RazorPageBase)
User

ClaimsPrincipal获取当前登录用户的 。

(继承自 RazorPageBase)
ViewBag

获取动态视图数据字典。

(继承自 RazorPageBase)
ViewContext

获取或设置呈现视图的视图上下文。

方法

AddHtmlAttributeValue(String, Int32, Object, Int32, Int32, Boolean)

添加 html 属性值。

(继承自 RazorPageBase)
BadRequest()

创建一个 BadRequestResult 生成响应的 Status400BadRequest

BadRequest(ModelStateDictionary)

创建一个 BadRequestObjectResult 生成响应的 Status400BadRequest

BadRequest(Object)

创建一个 BadRequestObjectResult 生成响应的 Status400BadRequest

BeginAddHtmlAttributeValues(TagHelperExecutionContext, String, Int32, HtmlAttributeValueStyle)

开始添加 html 属性值。

(继承自 RazorPageBase)
BeginContext(Int32, Int32, Boolean)

Razor 页面的基类。

BeginWriteAttribute(String, String, Int32, String, Int32, Int32)

开始写出属性。

(继承自 RazorPageBase)
BeginWriteTagHelperAttribute()

启动用于写入 ITagHelper 属性值的新范围。

(继承自 RazorPageBase)
Challenge()

创建一个 ChallengeResult

Challenge(AuthenticationProperties)

ChallengeResult使用指定的 properties创建 。

Challenge(AuthenticationProperties, String[])

ChallengeResult使用指定的身份验证方案和 properties创建 。

Challenge(String[])

ChallengeResult使用指定的身份验证方案创建 。

Content(String)

ContentResult通过指定字符串,使用 创建content对象Status200OK

Content(String, MediaTypeHeaderValue)

ContentResult通过指定content字符串和 contentType创建对象Status200OK

Content(String, String)

ContentResult通过指定content字符串和内容类型创建对象Status200OK

Content(String, String, Encoding)

ContentResult通过指定content字符串 、 contentTypecontentEncoding来创建对象Status200OK

CreateTagHelper<TTagHelper>()

创建并激活 ITagHelper

(继承自 RazorPageBase)
DefineSection(String, Func<Object,Task>)

在页面中创建一个命名内容节,该节可在布局页 RenderSection 中使用 或 调用 RenderSectionAsync

(继承自 RazorPageBase)
DefineSection(String, RenderAsyncDelegate)

在页面中创建一个命名内容节,该节可在布局页 RenderSection 中使用 或 调用 RenderSectionAsync

(继承自 RazorPageBase)
EndAddHtmlAttributeValues(TagHelperExecutionContext)

结束添加 html 属性值。

(继承自 RazorPageBase)
EndContext()

Razor 页面的基类。

EndTagHelperWritingScope()

结束通过调用 StartTagHelperWritingScope(HtmlEncoder)启动的当前写入范围。

(继承自 RazorPageBase)
EndWriteAttribute()

结束写入属性。

(继承自 RazorPageBase)
EndWriteTagHelperAttribute()

结束通过调用 BeginWriteTagHelperAttribute()启动的当前写入范围。

(继承自 RazorPageBase)
EnsureRenderedBodyOrSections()

验证中 PreviousSectionWriters 定义的所有节都已呈现,或者如果未定义任何部分,则呈现正文。

ExecuteAsync()

呈现页面并将输出写入 。Writer

(继承自 RazorPageBase)
File(Byte[], String)

返回一个文件,其中指定 fileContents 为内容 (Status200OK) ,指定 contentType 为 Content-Type。

File(Byte[], String, String)

返回一个文件,其中指定 fileContents 为内容 (Status200OK) ,指定 contentType 为 Content-Type,指定 fileDownloadName 为建议的文件名。

File(Stream, String)

返回指定 fileStream (Status200OK) 中指定 contentType 为 Content-Type 的文件。

File(Stream, String, String)

返回指定 fileStream (Status200OK) 的文件, contentType 指定的 作为 Content-Type,指定 fileDownloadName 为建议的文件名。

File(String, String)

返回由 virtualPath (Status200OK) 指定的文件,并将 指定 contentType 为 Content-Type。

File(String, String, String)

返回由 virtualPath (Status200OK) 指定的文件, contentType 指定的 作为 Content-Type,而指定 fileDownloadName 为建议的文件名。

FlushAsync()

FlushAsync()在 响应流上OutputStream.FlushAsync上调用 ,将任何缓冲内容写出到 。Body

(继承自 RazorPageBase)
Forbid()

默认情况下) ForbidResultStatus403Forbidden 创建 (。

Forbid(AuthenticationProperties)

默认情况下,ForbidResultStatus403Forbidden使用指定的 properties创建 () 。

Forbid(AuthenticationProperties, String[])

默认情况下,ForbidResultStatus403Forbidden使用指定的身份验证方案和 properties创建) (。

Forbid(String[])

默认情况下, ForbidResult 使用指定的身份验证方案创建) (Status403Forbidden

Href(String)

返回给定内容路径的 href。

(继承自 RazorPageBase)
InvalidTagHelperIndexerAssignment(String, String, String)

当标记帮助程序属性为 null时,设置有关使用索引器的错误消息的格式。

(继承自 RazorPageBase)
LocalRedirect(String)

创建一个 LocalRedirectResult 对象,该对象将 (Status302Found) 重定向到指定的本地 localUrl

LocalRedirectPermanent(String)

LocalRedirectResultPermanent使用指定的 localUrl创建设置为 true 的对象, (Status301MovedPermanently) 。

LocalRedirectPermanentPreserveMethod(String)

使用指定的 localUrl创建一个LocalRedirectResult对象Permanent,并将 设置为 true PreserveMethod (Status308PermanentRedirect) 。

LocalRedirectPreserveMethod(String)

LocalRedirectResultPermanent使用指定的 localUrl创建设置为 false 且PreserveMethod设置为 true 的对象,Status307TemporaryRedirect () 。

NotFound()

创建一个 NotFoundResult 生成响应的 Status404NotFound

NotFound(Object)

创建一个 NotFoundObjectResult 生成响应的 Status404NotFound

Page()

创建一个 PageResult 对象,该对象将此页面呈现为响应的视图。

Partial(String)

PartialViewResult通过指定要呈现的分部的名称来创建 。

Partial(String, Object)

PartialViewResult通过指定要呈现的分部的名称和模型对象来创建 。

PhysicalFile(String, String)

返回由 physicalPath (Status200OK) 指定的文件,并将 指定 contentType 为 Content-Type。

PhysicalFile(String, String, String)

返回由 physicalPath (Status200OK) 指定的文件, contentType 指定的 作为 Content-Type,而指定 fileDownloadName 为建议的文件名。

PopWriter()

从堆栈返回文本编写器。

(继承自 RazorPageBase)
PushWriter(TextWriter)

将文本编写器放在堆栈上。

(继承自 RazorPageBase)
Redirect(String)

创建重定向 RedirectResult 到指定 url的对象。

RedirectPermanent(String)

RedirectResultPermanent使用指定的 url创建设置为 true 的对象, (Status301MovedPermanently) 。

RedirectPermanentPreserveMethod(String)

使用指定的 url创建一个RedirectResult对象Permanent,并将 设置为 true PreserveMethod (Status308PermanentRedirect) 。

RedirectPreserveMethod(String)

RedirectResultPermanent使用指定的 url创建设置为 false 且PreserveMethod设置为 true 的对象,Status307TemporaryRedirect () 。

RedirectToAction(String)

使用 actionName将 (Status302Found) 重定向到指定的操作。

RedirectToAction(String, Object)

使用 actionNamerouteValues将 (Status302Found) 重定向到指定的操作。

RedirectToAction(String, String)

使用 actionNamecontrollerName将 (Status302Found) 重定向到指定的操作。

RedirectToAction(String, String, Object)

Status302Found 使用指定的 、 controllerNamerouteValues将 () 重定向到指定的actionName操作。

RedirectToAction(String, String, Object, String)

Status302Found 使用指定的 、、 controllerNamerouteValuesfragment将) (重定向到指定的actionName操作。

RedirectToAction(String, String, String)

Status302Found 使用指定的 、 controllerNamefragment将 () 重定向到指定的actionName操作。

RedirectToActionPermanent(String)

使用指定的 将 (Status301MovedPermanently) 重定向到设置为 true 的指定actionName操作Permanent

RedirectToActionPermanent(String, Object)

使用指定的 和 routeValues将) Status301MovedPermanently (重定向到设置为 true 的指定actionName操作Permanent

RedirectToActionPermanent(String, String)

使用指定的 和 controllerName将) Status301MovedPermanently (重定向到设置为 true 的指定actionName操作Permanent

RedirectToActionPermanent(String, String, Object)

使用指定的 、 和 将 (Status301MovedPermanently) 重定向到设置为 true 的指定actionName操作PermanentrouteValuescontrollerName

RedirectToActionPermanent(String, String, Object, String)

使用指定的 、、 routeValuescontrollerNamefragment将 (Status301MovedPermanently) 重定向到设置为 true 的指定actionName操作Permanent

RedirectToActionPermanent(String, String, String)

使用指定的 、 和 将 (Status301MovedPermanently) 重定向到设置为 true 的指定actionName操作PermanentfragmentcontrollerName

RedirectToActionPermanentPreserveMethod(String, String, Object, String)

使用指定的 、、 controllerNamerouteValuesfragment将 (Status308PermanentRedirect) 重定向到设置为 true 且PreserveMethod设置为 true 的指定actionName操作Permanent

RedirectToActionPreserveMethod(String, String, Object, String)

使用指定的 、、 和 将 (Status307TemporaryRedirect) 重定向到设置为 false 且PreserveMethod设置为 true 的指定routeValuesactionNamecontrollerName操作。Permanentfragment

RedirectToPage()

将 (Status302Found) 重定向到当前页。

RedirectToPage(Object)

将 (Status302Found) 重定向到具有指定 routeValues的当前页。

RedirectToPage(String)

将 (Status302Found) 重定向到指定的 pageName

RedirectToPage(String, Object)

使用指定的 将 (Status302Found) 重定向到指定的 pageNamerouteValues

RedirectToPage(String, String)

使用指定的 将 (Status302Found) 重定向到指定的 pageNamepageHandler

RedirectToPage(String, String, Object, String)

使用指定的 和 将 (Status302Found) 重定向到指定的 pageNamerouteValuesfragment

RedirectToPage(String, String, String)

使用指定的 将 (Status302Found) 重定向到指定的 pageNamefragment

RedirectToPagePermanent(String)

将 (Status301MovedPermanently) 重定向到指定的 pageName

RedirectToPagePermanent(String, Object)

使用指定的 将 (Status301MovedPermanently) 重定向到指定的 pageNamerouteValues

RedirectToPagePermanent(String, String)

使用指定的 将 (Status301MovedPermanently) 重定向到指定的 pageNamepageHandler

RedirectToPagePermanent(String, String, Object)

使用指定的 将 (Status301MovedPermanently) 重定向到指定的 pageNamerouteValues

RedirectToPagePermanent(String, String, Object, String)

使用指定的 和 将 (Status301MovedPermanently) 重定向到指定的 pageNamerouteValuesfragment

RedirectToPagePermanent(String, String, String)

使用指定的 将 (Status301MovedPermanently) 重定向到指定的 pageNamefragment

RedirectToPagePermanentPreserveMethod(String, String, Object, String)

使用pageName指定的 、 routeValuesfragment将) Status308PermanentRedirect (重定向到指定路由Permanent(设置为 true 和 PreserveMethod 设置为 true)。

RedirectToPagePreserveMethod(String, String, Object, String)

使用指定的 、 和 将 (Status307TemporaryRedirect) 重定向到设置为 false 且PreserveMethod设置为 true 的指定pageName页面PermanentfragmentrouteValues

RedirectToRoute(Object)

使用指定的 将 (Status302Found) 重定向到指定的 routeValues路由。

RedirectToRoute(String)

使用指定的 将 (Status302Found) 重定向到指定的 routeName路由。

RedirectToRoute(String, Object)

Status302Found 使用指定的 和 routeValues将 () 重定向到指定的routeName路由。

RedirectToRoute(String, Object, String)

Status302Found 使用指定的 、 routeValuesfragment将 () 重定向到指定的routeName路由。

RedirectToRoute(String, String)

Status302Found 使用指定的 和 fragment将 () 重定向到指定的routeName路由。

RedirectToRoutePermanent(Object)

使用指定的 将 (Status301MovedPermanently) 重定向到设置为 true 的指定routeValues路由Permanent

RedirectToRoutePermanent(String)

使用指定的 将 (Status301MovedPermanently) 重定向到设置为 true 的指定routeName路由Permanent

RedirectToRoutePermanent(String, Object)

使用指定的 和 routeValues将 (Status301MovedPermanently) 重定向到设置为 true 的指定routeName路由Permanent

RedirectToRoutePermanent(String, Object, String)

使用routeName指定的 、 routeValuesfragment将 (Status301MovedPermanently) 重定向到指定路由,并将 Permanent 设置为 true。

RedirectToRoutePermanent(String, String)

使用指定的 和 fragment将 (Status301MovedPermanently) 重定向到设置为 true 的指定routeName路由Permanent

RedirectToRoutePermanentPreserveMethod(String, Object, String)

使用routeName指定的 、 routeValuesfragment将) Status308PermanentRedirect (重定向到指定路由Permanent(设置为 true 和 PreserveMethod 设置为 true)。

RedirectToRoutePreserveMethod(String, Object, String)

使用指定的 、 和 将) Status307TemporaryRedirect (重定向到设置为 false 且PreserveMethod设置为 true 的指定routeName路由PermanentfragmentrouteValues

SetAntiforgeryCookieAndHeader()

在响应上设置反伪造 Cookie 和 X-Frame-Options 标头。

(继承自 RazorPageBase)
SignIn(ClaimsPrincipal, AuthenticationProperties, String)

SignInResult使用指定的身份验证方案和 properties创建 。

SignIn(ClaimsPrincipal, String)

SignInResult使用指定的身份验证方案创建 。

SignOut(AuthenticationProperties, String[])

SignOutResult使用指定的身份验证方案和 properties创建 。

SignOut(String[])

SignOutResult使用指定的身份验证方案创建 。

StartTagHelperWritingScope(HtmlEncoder)

启动新的写入范围,并选择性地覆盖 HtmlEncoder 该范围。

(继承自 RazorPageBase)
StatusCode(Int32)

StatusCodeResult通过指定 statusCode创建对象。

StatusCode(Int32, Object)

ObjectResult通过指定 statusCode 和 创建对象value

TryUpdateModelAsync(Object, Type, String)

使用 的当前 IValueProviderprefix中的值Page汇报指定的model实例。

TryUpdateModelAsync(Object, Type, String, IValueProvider, Func<ModelMetadata,Boolean>)

使用 valueProviderprefix汇报指定的model实例。

TryUpdateModelAsync<TModel>(TModel)

使用 的当前 IValueProvider中的值Page汇报指定的model实例。

TryUpdateModelAsync<TModel>(TModel, String)

使用 的当前 IValueProviderprefix中的值Page汇报指定的model实例。

TryUpdateModelAsync<TModel>(TModel, String, Expression<Func<TModel,Object>>[])

使用 的当前 IValueProviderprefix中的值Page汇报指定的model实例。

TryUpdateModelAsync<TModel>(TModel, String, Func<ModelMetadata,Boolean>)

使用 的当前 IValueProviderprefix中的值Page汇报指定的model实例。

TryUpdateModelAsync<TModel>(TModel, String, IValueProvider)

使用 valueProviderprefix汇报指定的model实例。

TryUpdateModelAsync<TModel>(TModel, String, IValueProvider, Expression<Func<TModel,Object>>[])

使用 valueProviderprefix汇报指定的model实例。

TryUpdateModelAsync<TModel>(TModel, String, IValueProvider, Func<ModelMetadata,Boolean>)

使用 valueProviderprefix汇报指定的model实例。

TryValidateModel(Object)

验证指定的 model 实例。

TryValidateModel(Object, String)

验证指定的 model 实例。

Unauthorized()

UnauthorizedResult创建生成响应的 Status401Unauthorized

ViewComponent(String)

ViewComponentResult通过指定要呈现的视图组件的名称来创建 。

ViewComponent(String, Object)

ViewComponentResult通过指定要呈现的视图组件的名称来创建 。

ViewComponent(Type)

ViewComponentResult通过指定要Type呈现的视图组件的 创建 。

ViewComponent(Type, Object)

ViewComponentResult通过指定要Type呈现的视图组件的 创建 。

Write(Object)

使用 HTML 编码将指定的 value 写入到 Output

(继承自 RazorPageBase)
Write(String)

使用 HTML 编码将指定的 value 写入到 Output

(继承自 RazorPageBase)
WriteAttributeValue(String, Int32, Object, Int32, Int32, Boolean)

写出属性值。

(继承自 RazorPageBase)
WriteLiteral(Object)

将指定的 value 不带 HTML 编码的 写入到 Output

(继承自 RazorPageBase)
WriteLiteral(String)

将指定的 value 不带 HTML 编码的 写入到 Output

(继承自 RazorPageBase)

适用于