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)

藉由指定字串和 來建立 ContentResultcontent 物件 Status200OKcontentType

Content(String, String)

ContentResult藉由指定 content 字串和內容類型來建立 物件 Status200OK

Content(String, String, Encoding)

ContentResult藉由指定字串、、 contentTypecontentEncoding 來建立 content 物件 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 () Status200OKcontentType 中指定為 Content-Type 的檔案,並將指定 fileDownloadName 為建議的檔案名。

File(String, String)

傳回指定為 Content-Type 的 (Status200OK) 所 virtualPath 指定的 contentType 檔案。

File(String, String, String)

virtualPath傳回 (指定的檔案 Status200OK ,) 指定 contentType 為 Content-Type,並將 指定 fileDownloadName 為建議的檔案名。

Forbid()

預設會建立 ForbidResult (Status403Forbidden) 。

Forbid(AuthenticationProperties)

ForbidResultStatus403Forbidden 根據預設,使用指定的 properties 建立 () 。

Forbid(AuthenticationProperties, String[])

根據預設, ForbidResultStatus403Forbidden 使用指定的驗證配置和 properties 建立 () 。

Forbid(String[])

ForbidResultStatus403Forbidden 根據預設,使用指定的驗證配置建立 () 。

LocalRedirect(String)

LocalRedirectResult建立 物件,將 (Status302Found) 重新導向至指定的本機 localUrl

LocalRedirectPermanent(String)

LocalRedirectResult使用指定的 localUrl 建立物件 Permanent ,並將 Status301MovedPermanently 設定為 true () 。

LocalRedirectPermanentPreserveMethod(String)

LocalRedirectResult使用指定的 localUrl 建立 物件, Permanent 並將 設定為 true,並將 PreserveMethod 設定為 true (Status308PermanentRedirect) 。

LocalRedirectPreserveMethod(String)

LocalRedirectResult使用指定的 localUrl 建立物件, Permanent 並將 設為 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)

傳回 (physicalPathStatus200OK 所指定的檔案,) 指定 contentType 為 Content-Type。

PhysicalFile(String, String, String)

傳回指定 physicalPath () Status200OK 指定的檔案,其 contentType 指定為 Content-Type,以及指定 fileDownloadName 為建議的檔案名。

Redirect(String)

建立 RedirectResult 物件,將 () Status302Found 重新導向至指定的 url

RedirectPermanent(String)

RedirectResult使用指定的 url 建立物件 Permanent ,並將 Status301MovedPermanently 設定為 true () 。

RedirectPermanentPreserveMethod(String)

RedirectResult使用指定的 url 建立物件, Permanent 並將 設定為 true,並將 PreserveMethod 設定為 true (Status308PermanentRedirect) 。

RedirectPreserveMethod(String)

RedirectResult使用指定的 url 建立物件, Permanent 並將 設定為 false,並將 PreserveMethod 設定為 true (Status307TemporaryRedirect) 。

RedirectToAction(String)

使用 actionName 將 () Status302Found 重新導向至指定的動作。

RedirectToAction(String, Object)

使用 actionNamerouteValues 將 () Status302Found 重新導向至指定的動作。

RedirectToAction(String, String)

使用 actionNamecontrollerName ,將 (Status302Found) 重新導向至指定的動作。

RedirectToAction(String, String, Object)

使用指定的 、 controllerNamerouteValues ,將 (Status302Found) 重新導向至指定的 actionName 動作。

RedirectToAction(String, String, Object, String)

使用指定的 、 、 和 ,將 (Status302Found) 重新導向至指定的 actionName 動作。 fragmentrouteValuescontrollerName

RedirectToAction(String, String, String)

使用指定的 、 controllerNamefragment ,將 (Status302Found) 重新導向至指定的 actionName 動作。

RedirectToActionPermanent(String)

使用指定的 actionName ,將 (Status301MovedPermanently) 重新導向至指定的動作,並將 Permanent 設定為 true。

RedirectToActionPermanent(String, Object)

使用指定的 和 routeValues ,將 (Status301MovedPermanently) 重新導向至設定為 true 的指定 actionName 動作 Permanent

RedirectToActionPermanent(String, String)

使用指定的 和 controllerName ,將 (Status301MovedPermanently) 重新導向至設定為 true 的指定 actionName 動作 Permanent

RedirectToActionPermanent(String, String, Object)

使用指定的 、 controllerNamerouteValues ,將 (Status301MovedPermanently) 重新導向至設定為 true 的指定 actionName 動作 Permanent

RedirectToActionPermanent(String, String, Object, String)

使用指定的 、 、 和 ,將 (Status301MovedPermanently) 重新導向至指定的動作,並將 fragmentPermanent 設定為 true。 routeValuescontrollerNameactionName

RedirectToActionPermanent(String, String, String)

使用指定的 、 controllerNamefragment ,將 (Status301MovedPermanently) 重新導向至設定為 true 的指定 actionName 動作 Permanent

RedirectToActionPermanentPreserveMethod(String, String, Object, String)

使用指定的 、 、 和 ,將 (Status308PermanentRedirect) 重新導向至指定的動作 Permanent ,並將 PreserveMethod 設定為 true。 fragmentrouteValuescontrollerNameactionName

RedirectToActionPreserveMethod(String, String, Object, String)

使用指定的 、 、 和 ,將 () Status307TemporaryRedirect 重新導向至指定的動作 Permanent ,並將 PreserveMethod 設定為 false 並 fragment 設定為 true。 routeValuescontrollerNameactionName

RedirectToPage()

將 (Status302Found) 重新導向至目前頁面。

RedirectToPage(Object)

使用指定的 routeValues ,將 (Status302Found) 重新導向至目前頁面。

RedirectToPage(String)

將 (Status302Found) 重新導向至指定的 pageName

RedirectToPage(String, Object)

使用指定的 ,將 () Status302Found 重新導向至指定的 pageNamerouteValues

RedirectToPage(String, String)

使用指定的 ,將 () Status302Found 重新導向至指定的 pageNamepageHandler

RedirectToPage(String, String, Object)

使用指定的 和 ,將 (Status302Found) 重新導向至指定的 pageNamepageHandlerrouteValues

RedirectToPage(String, String, Object, String)

使用指定的 和 ,將 (Status302Found) 重新導向至指定的 pageNamerouteValuesfragment

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) 重新導向至指定的 pageNamerouteValuesfragment

RedirectToPagePermanent(String, String, String)

使用指定的 ,將 () Status301MovedPermanently 重新導向至指定的 pageNamefragment

RedirectToPagePermanentPreserveMethod(String, String, Object, String)

使用指定的 pageNamerouteValues 和 ,將 () Status308PermanentRedirect 重新導向至指定的路由 Permanent ,並將 PreserveMethod 設定為 true。 fragment

RedirectToPagePreserveMethod(String, String, Object, String)

使用指定的 、 和 ,將 () Status307TemporaryRedirect 重新導向至指定的頁面 Permanent ,並將 PreserveMethod 設定為 false 並 fragment 設定為 true。 routeValuespageName

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)

使用指定的 routeValues ,將 (Status301MovedPermanently) 重新導向至指定的路由,並將 Permanent 設定為 true。

RedirectToRoutePermanent(String)

使用指定的 routeName ,將 (Status301MovedPermanently) 重新導向至指定的路由,並將 Permanent 設定為 true。

RedirectToRoutePermanent(String, Object)

使用 Status301MovedPermanently 指定的 routeNamerouteValues ,將 () 重新導向至指定的路由,並將 Permanent 設定為 true。

RedirectToRoutePermanent(String, Object, String)

使用指定的 routeName 、 和 ,將 () Status301MovedPermanently 重新導向至指定的路由,並將 Permanentfragment 設定為 routeValues true。

RedirectToRoutePermanent(String, String)

使用 Status301MovedPermanently 指定的 routeNamefragment ,將 () 重新導向至指定的路由,並將 Permanent 設定為 true。

RedirectToRoutePermanentPreserveMethod(String, Object, String)

使用指定的 routeNamerouteValues 和 ,將 () Status308PermanentRedirect 重新導向至指定的路由 Permanent ,並將 PreserveMethod 設定為 true。 fragment

RedirectToRoutePreserveMethod(String, Object, String)

使用指定的 、 和 ,將 () Status307TemporaryRedirect 重新導向至指定的路由 Permanent ,並將 PreserveMethod 設定為 false 並 fragment 設定為 true。 routeValuesrouteName

SignIn(ClaimsPrincipal, AuthenticationProperties, String)

SignInResult使用指定的驗證配置和 properties 建立 。

SignIn(ClaimsPrincipal, String)

使用指定的驗證配置建立 SignInResult

SignOut(AuthenticationProperties, String[])

SignOutResult使用指定的驗證配置和 properties 建立 。

SignOut(String[])

使用指定的驗證配置建立 SignOutResult

StatusCode(Int32)

藉由指定 statusCode 來建立 StatusCodeResult 物件。

StatusCode(Int32, Object)

藉由指定 statusCode 和 來建立 ObjectResult 物件value

TryUpdateModelAsync(Object, Type, String)

更新指定的 model 實例使用 來自 PageModel 目前 IValueProvidername 的值。

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

使用 和 name 更新指定的 model 實例 valueProvider

TryUpdateModelAsync<TModel>(TModel)

使用目前 IValueProvider 的值 PageModel 更新指定的 model 實例。

TryUpdateModelAsync<TModel>(TModel, String)

使用目前 IValueProvider 的值 PageModel 更新指定的 model 實例。

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

更新指定的 model 實例使用 來自 PageModel 目前 IValueProvidername 的值。

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

更新指定的 model 實例使用 來自 PageModel 目前 IValueProvidername 的值。

TryUpdateModelAsync<TModel>(TModel, String, IValueProvider)

使用 和 name 更新指定的 model 實例 valueProvider

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

使用 和 name 更新指定的 model 實例 valueProvider

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

使用 和 name 更新指定的 model 實例 valueProvider

TryValidateModel(Object)

驗證指定的 model 實例。

TryValidateModel(Object, String)

驗證指定的 model 實例。

Unauthorized()

UnauthorizedResult建立產生回應的 Status401Unauthorized

ViewComponent(String)

指定要 ViewComponentResult 轉譯的檢視元件名稱,以建立 。

ViewComponent(String, Object)

指定要 ViewComponentResult 轉譯的檢視元件名稱,以建立 。

ViewComponent(Type)

指定要 ViewComponentResultType 轉譯之檢視元件的 ,以建立 。

ViewComponent(Type, Object)

指定要 ViewComponentResultType 轉譯之檢視元件的 ,以建立 。

適用於