共用方式為


RedirectHttpResult Class

Definition

An IResult that returns a Found (302), Moved Permanently (301), Temporary Redirect (307), or Permanent Redirect (308) response with a Location header to the supplied URL.

public sealed class RedirectHttpResult : Microsoft.AspNetCore.Http.IResult
type RedirectHttpResult = class
    interface IResult
Public NotInheritable Class RedirectHttpResult
Implements IResult
Inheritance
RedirectHttpResult
Implements

Properties

Name Description
AcceptLocalUrlOnly

Gets an indication that only local URLs are accepted.

Permanent

Gets the value that specifies that the redirect should be permanent if true or temporary if false.

PreserveMethod

Gets an indication that the redirect preserves the initial request method.

Url

Gets the URL to redirect to.

Methods

Name Description
ExecuteAsync(HttpContext)

Write an HTTP response reflecting the result.

IsLocalUrl(String)

Returns a value that indicates whether the URL is local. A URL is considered local if it does not have a host / authority part and it has an absolute path. URLs using virtual paths ('~/') are also local.

Applies to