PageModel PageModel PageModel Class

Definition

[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
type PageModel = class
    interface IAsyncPageFilter
    interface IFilterMetadata
    interface IPageFilter
Public MustInherit Class PageModel
Implements IAsyncPageFilter, IFilterMetadata, IPageFilter
Inheritance
PageModelPageModelPageModel
Derived
Attributes
Implements

Constructors

PageModel() PageModel() PageModel()

Properties

HttpContext HttpContext HttpContext

Gets the HttpContext.

ModelState ModelState ModelState

Gets the ModelStateDictionary.

PageContext PageContext PageContext

Gets the PageContext.

Request Request Request

Gets the HttpRequest.

Response Response Response

Gets the HttpResponse.

RouteData RouteData RouteData

Gets the RouteData for the executing action.

TempData TempData TempData

Gets or sets ITempDataDictionary used by PageResult.

Url Url Url

Gets or sets the IUrlHelper.

User User User

Gets the ClaimsPrincipal for user associated with the executing action.

ViewData ViewData ViewData

Gets or sets ViewDataDictionary used by PageResult.

Methods

BadRequest() BadRequest() BadRequest()

Creates a BadRequestResult that produces a Status400BadRequest response.

BadRequest(ModelStateDictionary) BadRequest(ModelStateDictionary) BadRequest(ModelStateDictionary)

Creates a BadRequestObjectResult that produces a Status400BadRequest response.

BadRequest(Object) BadRequest(Object) BadRequest(Object)

Creates a BadRequestObjectResult that produces a Status400BadRequest response.

Challenge() Challenge() Challenge()

Creates a ChallengeResult.

Challenge(AuthenticationProperties) Challenge(AuthenticationProperties) Challenge(AuthenticationProperties)

Creates a ChallengeResult with the specified properties.

Challenge(String[]) Challenge(String[]) Challenge(String[])

Creates a ChallengeResult with the specified authentication schemes.

Challenge(AuthenticationProperties, String[]) Challenge(AuthenticationProperties, String[]) Challenge(AuthenticationProperties, String[])

Creates a ChallengeResult with the specified authentication schemes and properties.

Content(String) Content(String) Content(String)

Creates a ContentResult object with Status200OK by specifying a content string.

Content(String, MediaTypeHeaderValue) Content(String, MediaTypeHeaderValue) Content(String, MediaTypeHeaderValue)

Creates a ContentResult object with Status200OK by specifying a content string and a contentType.

Content(String, String) Content(String, String) Content(String, String)

Creates a ContentResult object with Status200OK by specifying a content string and a content type.

Content(String, String, Encoding) Content(String, String, Encoding) Content(String, String, Encoding)

Creates a ContentResult object with Status200OK by specifying a content string, a contentType, and contentEncoding.

File(String, String, String) File(String, String, String) File(String, String, String)

Returns the file specified by virtualPath (Status200OK) with the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

File(Stream, String, String) File(Stream, String, String) File(Stream, String, String)

Returns a file in the specified fileStream (Status200OK) with the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

File(Byte[], String, String) File(Byte[], String, String) File(Byte[], String, String)

Returns a file with the specified fileContents as content (Status200OK), the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

File(Stream, String) File(Stream, String) File(Stream, String)

Returns a file in the specified fileStream (Status200OK) with the specified contentType as the Content-Type.

File(Byte[], String) File(Byte[], String) File(Byte[], String)

Returns a file with the specified fileContents as content (Status200OK) and the specified contentType as the Content-Type.

File(String, String) File(String, String) File(String, String)

Returns the file specified by virtualPath (Status200OK) with the specified contentType as the Content-Type.

Forbid() Forbid() Forbid()

Creates a ForbidResult (Status403Forbidden by default).

Forbid(AuthenticationProperties) Forbid(AuthenticationProperties) Forbid(AuthenticationProperties)

Creates a ForbidResult (Status403Forbidden by default) with the specified properties.

Forbid(String[]) Forbid(String[]) Forbid(String[])

Creates a ForbidResult (Status403Forbidden by default) with the specified authentication schemes.

Forbid(AuthenticationProperties, String[]) Forbid(AuthenticationProperties, String[]) Forbid(AuthenticationProperties, String[])

Creates a ForbidResult (Status403Forbidden by default) with the specified authentication schemes and properties.

LocalRedirect(String) LocalRedirect(String) LocalRedirect(String)

Creates a LocalRedirectResult object that redirects (Status302Found) to the specified local localUrl.

LocalRedirectPermanent(String) LocalRedirectPermanent(String) LocalRedirectPermanent(String)

Creates a LocalRedirectResult object with Permanent set to true (Status301MovedPermanently) using the specified localUrl.

LocalRedirectPermanentPreserveMethod(String) LocalRedirectPermanentPreserveMethod(String) LocalRedirectPermanentPreserveMethod(String)

Creates a LocalRedirectResult object with Permanent set to true and PreserveMethod set to true (Status308PermanentRedirect) using the specified localUrl.

LocalRedirectPreserveMethod(String) LocalRedirectPreserveMethod(String) LocalRedirectPreserveMethod(String)

Creates a LocalRedirectResult object with Permanent set to false and PreserveMethod set to true (Status307TemporaryRedirect) using the specified localUrl.

NotFound() NotFound() NotFound()

Creates an NotFoundResult that produces a Status404NotFound response.

NotFound(Object) NotFound(Object) NotFound(Object)

Creates an NotFoundObjectResult that produces a Status404NotFound response.

OnPageHandlerExecuted(PageHandlerExecutedContext) OnPageHandlerExecuted(PageHandlerExecutedContext) OnPageHandlerExecuted(PageHandlerExecutedContext)

Called after the handler method executes, before the action result executes.

OnPageHandlerExecuting(PageHandlerExecutingContext) OnPageHandlerExecuting(PageHandlerExecutingContext) OnPageHandlerExecuting(PageHandlerExecutingContext)

Called before the handler method executes, after model binding is complete.

OnPageHandlerExecutionAsync(PageHandlerExecutingContext, PageHandlerExecutionDelegate) OnPageHandlerExecutionAsync(PageHandlerExecutingContext, PageHandlerExecutionDelegate) OnPageHandlerExecutionAsync(PageHandlerExecutingContext, PageHandlerExecutionDelegate)

Called asynchronously before the handler method is invoked, after model binding is complete.

OnPageHandlerSelected(PageHandlerSelectedContext) OnPageHandlerSelected(PageHandlerSelectedContext) OnPageHandlerSelected(PageHandlerSelectedContext)

Called after a handler method has been selected, but before model binding occurs.

OnPageHandlerSelectionAsync(PageHandlerSelectedContext) OnPageHandlerSelectionAsync(PageHandlerSelectedContext) OnPageHandlerSelectionAsync(PageHandlerSelectedContext)

Called asynchronously after the handler method has been selected, but before model binding occurs.

Page() Page() Page()

Creates a PageResult object that renders the page.

PhysicalFile(String, String) PhysicalFile(String, String) PhysicalFile(String, String)

Returns the file specified by physicalPath (Status200OK) with the specified contentType as the Content-Type.

PhysicalFile(String, String, String) PhysicalFile(String, String, String) PhysicalFile(String, String, String)

Returns the file specified by physicalPath (Status200OK) with the specified contentType as the Content-Type and the specified fileDownloadName as the suggested file name.

Redirect(String) Redirect(String) Redirect(String)

Creates a RedirectResult object that redirects (Status302Found) to the specified url.

RedirectPermanent(String) RedirectPermanent(String) RedirectPermanent(String)

Creates a RedirectResult object with Permanent set to true (Status301MovedPermanently) using the specified url.

RedirectPermanentPreserveMethod(String) RedirectPermanentPreserveMethod(String) RedirectPermanentPreserveMethod(String)

Creates a RedirectResult object with Permanent set to true and PreserveMethod set to true (Status308PermanentRedirect) using the specified url.

RedirectPreserveMethod(String) RedirectPreserveMethod(String) RedirectPreserveMethod(String)

Creates a RedirectResult object with Permanent set to false and PreserveMethod set to true (Status307TemporaryRedirect) using the specified url.

RedirectToAction(String) RedirectToAction(String) RedirectToAction(String)

Redirects (Status302Found) to the specified action using the actionName.

RedirectToAction(String, Object) RedirectToAction(String, Object) RedirectToAction(String, Object)

Redirects (Status302Found) to the specified action using the actionName and routeValues.

RedirectToAction(String, String) RedirectToAction(String, String) RedirectToAction(String, String)

Redirects (Status302Found) to the specified action using the actionName and the controllerName.

RedirectToAction(String, String, Object) RedirectToAction(String, String, Object) RedirectToAction(String, String, Object)

Redirects (Status302Found) to the specified action using the specified actionName, controllerName, and routeValues.

RedirectToAction(String, String, String) RedirectToAction(String, String, String) RedirectToAction(String, String, String)

Redirects (Status302Found) to the specified action using the specified actionName, controllerName, and fragment.

RedirectToAction(String, String, Object, String) RedirectToAction(String, String, Object, String) RedirectToAction(String, String, Object, String)

Redirects (Status302Found) to the specified action using the specified actionName, controllerName, routeValues, and fragment.

RedirectToActionPermanent(String) RedirectToActionPermanent(String) RedirectToActionPermanent(String)

Redirects (Status301MovedPermanently) to the specified action with Permanent set to true using the specified actionName.

RedirectToActionPermanent(String, Object) RedirectToActionPermanent(String, Object) RedirectToActionPermanent(String, Object)

Redirects (Status301MovedPermanently) to the specified action with Permanent set to true using the specified actionName and routeValues.

RedirectToActionPermanent(String, String) RedirectToActionPermanent(String, String) RedirectToActionPermanent(String, String)

Redirects (Status301MovedPermanently) to the specified action with Permanent set to true using the specified actionName and controllerName.

RedirectToActionPermanent(String, String, Object) RedirectToActionPermanent(String, String, Object) RedirectToActionPermanent(String, String, Object)

Redirects (Status301MovedPermanently) to the specified action with Permanent set to true using the specified actionName, controllerName, and routeValues.

RedirectToActionPermanent(String, String, String) RedirectToActionPermanent(String, String, String) RedirectToActionPermanent(String, String, String)

Redirects (Status301MovedPermanently) to the specified action with Permanent set to true using the specified actionName, controllerName, and fragment.

RedirectToActionPermanent(String, String, Object, String) RedirectToActionPermanent(String, String, Object, String) RedirectToActionPermanent(String, String, Object, String)

Redirects (Status301MovedPermanently) to the specified action with Permanent set to true using the specified actionName, controllerName, routeValues, and fragment.

RedirectToActionPermanentPreserveMethod(String, String, Object, String) RedirectToActionPermanentPreserveMethod(String, String, Object, String) RedirectToActionPermanentPreserveMethod(String, String, Object, String)

Redirects (Status308PermanentRedirect) to the specified action with Permanent set to true and PreserveMethod set to true, using the specified actionName, controllerName, routeValues, and fragment.

RedirectToActionPreserveMethod(String, String, Object, String) RedirectToActionPreserveMethod(String, String, Object, String) RedirectToActionPreserveMethod(String, String, Object, String)

Redirects (Status307TemporaryRedirect) to the specified action with Permanent set to false and PreserveMethod set to true, using the specified actionName, controllerName, routeValues, and fragment.

RedirectToPage() RedirectToPage() RedirectToPage()

Redirects (Status302Found) to the current page.

RedirectToPage(Object) RedirectToPage(Object) RedirectToPage(Object)

Redirects (Status302Found) to the current page with the specified routeValues.

RedirectToPage(String) RedirectToPage(String) RedirectToPage(String)

Redirects (Status302Found) to the specified pageName.

RedirectToPage(String, Object) RedirectToPage(String, Object) RedirectToPage(String, Object)

Redirects (Status302Found) to the specified pageName using the specified routeValues.

RedirectToPage(String, String) RedirectToPage(String, String) RedirectToPage(String, String)

Redirects (Status302Found) to the specified pageName using the specified pageHandler.

RedirectToPage(String, String, Object) RedirectToPage(String, String, Object) RedirectToPage(String, String, Object)

Redirects (Status302Found) to the specified pageName using the specified pageHandler and routeValues.

RedirectToPage(String, String, String) RedirectToPage(String, String, String) RedirectToPage(String, String, String)

Redirects (Status302Found) to the specified pageName using the specified fragment.

RedirectToPage(String, String, Object, String) RedirectToPage(String, String, Object, String) RedirectToPage(String, String, Object, String)

Redirects (Status302Found) to the specified pageName using the specified routeValues and fragment.

RedirectToPagePermanent(String, String, Object, String) RedirectToPagePermanent(String, String, Object, String) RedirectToPagePermanent(String, String, Object, String)

Redirects (Status301MovedPermanently) to the specified pageName using the specified routeValues and fragment.

RedirectToPagePermanent(String, String, String) RedirectToPagePermanent(String, String, String) RedirectToPagePermanent(String, String, String)

Redirects (Status301MovedPermanently) to the specified pageName using the specified fragment.

RedirectToPagePermanent(String, String, Object) RedirectToPagePermanent(String, String, Object) RedirectToPagePermanent(String, String, Object)

Redirects (Status301MovedPermanently) to the specified pageName using the specified routeValues.

RedirectToPagePermanent(String, Object, String) RedirectToPagePermanent(String, Object, String) RedirectToPagePermanent(String, Object, String)

Redirects (Status301MovedPermanently) to the specified pageName using the specified fragment.

RedirectToPagePermanent(String, String) RedirectToPagePermanent(String, String) RedirectToPagePermanent(String, String)

Redirects (Status301MovedPermanently) to the specified pageName.

RedirectToPagePermanent(String, Object) RedirectToPagePermanent(String, Object) RedirectToPagePermanent(String, Object)

Redirects (Status301MovedPermanently) to the specified pageName using the specified routeValues.

RedirectToPagePermanent(String) RedirectToPagePermanent(String) RedirectToPagePermanent(String)

Redirects (Status301MovedPermanently) to the specified pageName.

RedirectToPagePermanentPreserveMethod(String, String, Object, String) RedirectToPagePermanentPreserveMethod(String, String, Object, String) RedirectToPagePermanentPreserveMethod(String, String, Object, String)

Redirects (Status308PermanentRedirect) to the specified route with Permanent set to true and PreserveMethod set to true, using the specified pageName, routeValues, and fragment.

RedirectToPagePreserveMethod(String, String, Object, String) RedirectToPagePreserveMethod(String, String, Object, String) RedirectToPagePreserveMethod(String, String, Object, String)

Redirects (Status307TemporaryRedirect) to the specified page with Permanent set to false and PreserveMethod set to true, using the specified pageName, routeValues, and fragment.

RedirectToRoute(Object) RedirectToRoute(Object) RedirectToRoute(Object)

Redirects (Status302Found) to the specified route using the specified routeValues.

RedirectToRoute(String) RedirectToRoute(String) RedirectToRoute(String)

Redirects (Status302Found) to the specified route using the specified routeName.

RedirectToRoute(String, Object) RedirectToRoute(String, Object) RedirectToRoute(String, Object)

Redirects (Status302Found) to the specified route using the specified routeName and routeValues.

RedirectToRoute(String, String) RedirectToRoute(String, String) RedirectToRoute(String, String)

Redirects (Status302Found) to the specified route using the specified routeName and fragment.

RedirectToRoute(String, Object, String) RedirectToRoute(String, Object, String) RedirectToRoute(String, Object, String)

Redirects (Status302Found) to the specified route using the specified routeName, routeValues, and fragment.

RedirectToRoutePermanent(String, String) RedirectToRoutePermanent(String, String) RedirectToRoutePermanent(String, String)

Redirects (Status301MovedPermanently) to the specified route with Permanent set to true using the specified routeName and fragment.

RedirectToRoutePermanent(String, Object) RedirectToRoutePermanent(String, Object) RedirectToRoutePermanent(String, Object)

Redirects (Status301MovedPermanently) to the specified route with Permanent set to true using the specified routeName and routeValues.

RedirectToRoutePermanent(String, Object, String) RedirectToRoutePermanent(String, Object, String) RedirectToRoutePermanent(String, Object, String)

Redirects (Status301MovedPermanently) to the specified route with Permanent set to true using the specified routeName, routeValues, and fragment.

RedirectToRoutePermanent(Object) RedirectToRoutePermanent(Object) RedirectToRoutePermanent(Object)

Redirects (Status301MovedPermanently) to the specified route with Permanent set to true using the specified routeValues.

RedirectToRoutePermanent(String) RedirectToRoutePermanent(String) RedirectToRoutePermanent(String)

Redirects (Status301MovedPermanently) to the specified route with Permanent set to true using the specified routeName.

RedirectToRoutePermanentPreserveMethod(String, Object, String) RedirectToRoutePermanentPreserveMethod(String, Object, String) RedirectToRoutePermanentPreserveMethod(String, Object, String)

Redirects (Status308PermanentRedirect) to the specified route with Permanent set to true and PreserveMethod set to true, using the specified routeName, routeValues, and fragment.

RedirectToRoutePreserveMethod(String, Object, String) RedirectToRoutePreserveMethod(String, Object, String) RedirectToRoutePreserveMethod(String, Object, String)

Redirects (Status307TemporaryRedirect) to the specified route with Permanent set to false and PreserveMethod set to true, using the specified routeName, routeValues, and fragment.

SignIn(ClaimsPrincipal, String) SignIn(ClaimsPrincipal, String) SignIn(ClaimsPrincipal, String)

Creates a SignInResult with the specified authentication scheme.

SignIn(ClaimsPrincipal, AuthenticationProperties, String) SignIn(ClaimsPrincipal, AuthenticationProperties, String) SignIn(ClaimsPrincipal, AuthenticationProperties, String)

Creates a SignInResult with the specified authentication scheme and properties.

SignOut(String[]) SignOut(String[]) SignOut(String[])

Creates a SignOutResult with the specified authentication schemes.

SignOut(AuthenticationProperties, String[]) SignOut(AuthenticationProperties, String[]) SignOut(AuthenticationProperties, String[])

Creates a SignOutResult with the specified authentication schemes and properties.

StatusCode(Int32) StatusCode(Int32) StatusCode(Int32)

Creates a StatusCodeResult object by specifying a statusCode.

StatusCode(Int32, Object) StatusCode(Int32, Object) StatusCode(Int32, Object)

Creates a ObjectResult object by specifying a statusCode and value

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

Updates the specified model instance using the valueProvider and a name.

TryUpdateModelAsync(Object, Type, String) TryUpdateModelAsync(Object, Type, String) TryUpdateModelAsync(Object, Type, String)

Updates the specified model instance using values from the PageModel's current IValueProvider and a name.

TryUpdateModelAsync<TModel>(TModel) TryUpdateModelAsync<TModel>(TModel) TryUpdateModelAsync<TModel>(TModel)

Updates the specified model instance using values from the PageModel's current IValueProvider.

TryUpdateModelAsync<TModel>(TModel, String) TryUpdateModelAsync<TModel>(TModel, String) TryUpdateModelAsync<TModel>(TModel, String)

Updates the specified model instance using values from the PageModel's current IValueProvider.

TryUpdateModelAsync<TModel>(TModel, String, IValueProvider) TryUpdateModelAsync<TModel>(TModel, String, IValueProvider) TryUpdateModelAsync<TModel>(TModel, String, IValueProvider)

Updates the specified model instance using the valueProvider and a name.

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

Updates the specified model instance using values from the PageModel's current IValueProvider and a name.

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

Updates the specified model instance using values from the PageModel's current IValueProvider and a name.

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

Updates the specified model instance using the valueProvider and a name.

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

Updates the specified model instance using the valueProvider and a name.

TryValidateModel(Object) TryValidateModel(Object) TryValidateModel(Object)

Validates the specified model instance.

TryValidateModel(Object, String) TryValidateModel(Object, String) TryValidateModel(Object, String)

Validates the specified model instance.

Unauthorized() Unauthorized() Unauthorized()

Creates an UnauthorizedResult that produces an Status401Unauthorized response.

Applies to