'Can asp.net core (.net 5 ) web api controller redirect to web page

since the .NET 5 web Api doesn't have a webpage or ui as such, can we do a redirect to another webpage (http://somedomain.com/) Bit if i do the same in .net mvc it works fine . IF we cannt do a redirect from api what is the alternative ?

Our requirement is to call web api , do some work inside that and redirect to web page

Below code for .NET 5 web Api doesn't work

[Route("api/[controller]")]
[ApiController]
public class RedirectController : ControllerBase
{

[HttpGet]
    public IActionResult GetRedirect()
    {
        //Do some work
        return Redirect("http://somedomain.com/account?id=1234&code=NEW");
    }

}

public class HomeController : Controller
{
    private readonly ILogger<HomeController> _logger;

    public IActionResult Privacy()
    {
        //Do some work
        return Redirect("http://somedomain.com/account?id=1234&code=NEW");
       
    }
 }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source