ResponseExtensions.Redirect(HttpResponse, String, Boolean, Boolean) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
(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) 。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈