Answers:
当然:
public HttpResponseMessage Post()
{
// ... do the job
// now redirect
var response = Request.CreateResponse(HttpStatusCode.Moved);
response.Headers.Location = new Uri("http://www.abcmvc.com");
return response;
}
[HttpGet]
public RedirectResult Get()
{
return RedirectPermanent("https://www.google.com");
}
你可以检查一下
[Route("Report/MyReport")]
public IHttpActionResult GetReport()
{
string url = "https://localhost:44305/Templates/ReportPage.html";
System.Uri uri = new System.Uri(url);
return Redirect(uri);
}
HttpStatusCode.Redirect
(302)或.RedirectMethod
(303)