How to Redirect in ASPNET Web API

前端 未结 2 898
广开言路
广开言路 2020-12-31 07:23

Is there a Web API controller method equivalent to the MVC controller method RedirectToAction? I would like to call one method from another, but retain the filter actions fo

2条回答
  •  攒了一身酷
    2020-12-31 07:50

    You can check this for redirecting a page from a controller in web api

    [Route("Report/MyReport")]
    public async Task getReport() {
    
        string url = "https://localhost:44305/Templates/ReportPage.html";
    
        System.Uri uri = new System.Uri(url);
    
        return Redirect(uri);
    }
    

提交回复
热议问题