ResponseExtensions.Redirect(HttpResponse, String, Boolean, Boolean) 方法

定义

(HTTP 301、HTTP 302、HTTP 307 或 HTTP 308) 返回重定向响应。

public:
[System::Runtime::CompilerServices::Extension]
 static void Redirect(Microsoft::AspNetCore::Http::HttpResponse ^ response, System::String ^ location, bool permanent, bool preserveMethod);
public static void Redirect (this Microsoft.AspNetCore.Http.HttpResponse response, string location, bool permanent, bool preserveMethod);
static member Redirect : Microsoft.AspNetCore.Http.HttpResponse * string * bool * bool -> unit
<Extension()>
Public Sub Redirect (response As HttpResponse, location As String, permanent As Boolean, preserveMethod As Boolean)

参数

response
HttpResponse

HttpResponse要重定向的 。

location
String

将客户端重定向到的 URL。 必须正确编码才能在仅允许 ASCII 字符的 http 标头中使用。

permanent
Boolean

True 如果重定向是永久 (301 或 308) ,则为 ;否则 false (302 或 307) 。

preserveMethod
Boolean

True 如果重定向需要重用方法和正文 (308 或 307) ,则 false (301 或 302) 。

适用于