PageModel 类

定义

表示 Page 的抽象类

public ref class PageModel abstract
public ref class PageModel abstract : Microsoft::AspNetCore::Mvc::Filters::IAsyncPageFilter, Microsoft::AspNetCore::Mvc::Filters::IFilterMetadata, Microsoft::AspNetCore::Mvc::Filters::IPageFilter
[Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageModel]
public abstract class PageModel
[Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageModel]
public abstract class PageModel : Microsoft.AspNetCore.Mvc.Filters.IAsyncPageFilter, Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata, Microsoft.AspNetCore.Mvc.Filters.IPageFilter
[<Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageModel>]
type PageModel = class
[<Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageModel>]
type PageModel = class
    interface IAsyncPageFilter
    interface IFilterMetadata
    interface IPageFilter
Public MustInherit Class PageModel
Public MustInherit Class PageModel
Implements IAsyncPageFilter, IFilterMetadata, IPageFilter
继承
PageModel
派生
属性
实现

构造函数

PageModel()

表示 Page 的抽象类

属性

HttpContext

获取 HttpContext

MetadataProvider

获取或设置 IModelMetadataProvider

ModelState

获取 ModelStateDictionary

PageContext

获取 PageContext

Request

获取 HttpRequest

Response

获取 HttpResponse

RouteData

获取 RouteData 执行操作的 。

TempData

获取或设置 ITempDataDictionary 使用的 PageResult

Url

获取或设置 IUrlHelper

User

获取与 ClaimsPrincipal 执行操作关联的用户的 。

ViewData

获取 ViewDataDictionary

方法

BadRequest()

创建一个 BadRequestResult 生成响应的 Status400BadRequest

BadRequest(ModelStateDictionary)

创建一个 BadRequestObjectResult 生成响应的 Status400BadRequest

BadRequest(Object)

创建一个 BadRequestObjectResult 生成响应的 Status400BadRequest

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

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 为建议的文件名。

Forbid()

默认情况下) ForbidResultStatus403Forbidden 创建 (。

Forbid(AuthenticationProperties)

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

Forbid(AuthenticationProperties, String[])

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

Forbid(String[])

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

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

OnPageHandlerExecuted(PageHandlerExecutedContext)

在处理程序方法执行之后,在操作结果执行之前调用。

OnPageHandlerExecuting(PageHandlerExecutingContext)

在处理程序方法执行之前调用,在模型绑定完成后调用。

OnPageHandlerExecutionAsync(PageHandlerExecutingContext, PageHandlerExecutionDelegate)

在调用处理程序方法之前,在模型绑定完成后异步调用。

OnPageHandlerSelected(PageHandlerSelectedContext)

在选择处理程序方法后但在模型绑定发生之前调用。

OnPageHandlerSelectionAsync(PageHandlerSelectedContext)

在选择处理程序方法之后但在模型绑定发生之前以异步方式调用。

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 作为建议的文件名。

Redirect(String)

创建一个 RedirectResult 对象,该对象将 (Status302Found) 重定向到指定的 url

RedirectPermanent(String)

RedirectResult使用指定的 url创建设置为 true (Status301MovedPermanently) 的对象Permanent

RedirectPermanentPreserveMethod(String)

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

RedirectPreserveMethod(String)

使用指定的 url创建一个RedirectResult对象,该Permanent对象将 设置为 false,PreserveMethod (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)

使用指定的 、Status302FoundcontrollerNamerouteValues、 和 fragment将 () 重定向到指定的actionName操作。

RedirectToAction(String, String, String)

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

RedirectToActionPermanent(String)

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

RedirectToActionPermanent(String, Object)

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

RedirectToActionPermanent(String, String)

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

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)

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

RedirectToActionPreserveMethod(String, String, Object, String)

使用routeValuescontrollerNameactionName指定的 、、 和 将 (Status307TemporaryRedirect) 重定向到指定操作Permanent,并将 设置为 false PreserveMethodfragment设置为 true。

RedirectToPage()

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

RedirectToPage(Object)

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

RedirectToPage(String)

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

RedirectToPage(String, Object)

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

RedirectToPage(String, String)

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

RedirectToPage(String, String, Object)

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

RedirectToPage(String, String, Object, String)

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

RedirectToPage(String, String, String)

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

RedirectToPagePermanent(String)

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

RedirectToPagePermanent(String, Object)

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

RedirectToPagePermanent(String, Object, String)

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

RedirectToPagePermanent(String, String)

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

RedirectToPagePermanent(String, String, Object)

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

RedirectToPagePermanent(String, String, Object, String)

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

RedirectToPagePermanent(String, String, String)

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

RedirectToPagePermanentPreserveMethod(String, String, Object, String)

使用指定的 、 和 将 (Status308PermanentRedirect) 重定向到指定路由,并将 PermanentPreserveMethod 设置为 true 并fragment设置为 truepageNamerouteValues

RedirectToPagePreserveMethod(String, String, Object, String)

使用指定的 、 routeValues和 将 (Status307TemporaryRedirect) 重定向到指定页面,并将 Permanent 设置为 false PreserveMethodfragment设置为 true。pageName

RedirectToRoute(Object)

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

RedirectToRoute(String)

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

RedirectToRoute(String, Object)

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

RedirectToRoute(String, Object, String)

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

RedirectToRoute(String, String)

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

RedirectToRoutePermanent(Object)

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

RedirectToRoutePermanent(String)

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

RedirectToRoutePermanent(String, Object)

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

RedirectToRoutePermanent(String, Object, String)

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

RedirectToRoutePermanent(String, String)

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

RedirectToRoutePermanentPreserveMethod(String, Object, String)

使用指定的 、 和 将 (Status308PermanentRedirect) 重定向到指定路由,并将 PermanentPreserveMethod 设置为 true 并fragment设置为 truerouteNamerouteValues

RedirectToRoutePreserveMethod(String, Object, String)

使用指定的 、 routeValues和 ,将 (Status307TemporaryRedirect) 重定向到指定路由,并将 Permanent 设置为 false PreserveMethodfragment设置为 true。routeName

SignIn(ClaimsPrincipal, AuthenticationProperties, String)

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

SignIn(ClaimsPrincipal, String)

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

SignOut(AuthenticationProperties, String[])

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

SignOut(String[])

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

StatusCode(Int32)

StatusCodeResult通过指定 statusCode创建 对象。

StatusCode(Int32, Object)

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

TryUpdateModelAsync(Object, Type, String)

使用 的当前 IValueProvidername中的值PageModel汇报指定的model实例。

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

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

TryUpdateModelAsync<TModel>(TModel)

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

TryUpdateModelAsync<TModel>(TModel, String)

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

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

使用 的当前 IValueProvidername中的值PageModel汇报指定的model实例。

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

使用 的当前 IValueProvidername中的值PageModel汇报指定的model实例。

TryUpdateModelAsync<TModel>(TModel, String, IValueProvider)

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

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

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

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

使用 valueProvidername汇报指定的 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呈现的视图组件的 创建 。

适用于