I am using Blazor and I have an instance where I need to redirect the user to an external site which I pass them a url to return to.
The url they return to, they want to POST the data back into my application so I have created an ApiController
in the blazor application and the data is coming back into there fine, but is there a way I can now use the NavigationManager
or something like that to redirect the user?
NOTE: Blazor doesn't handle POST Requests to .razor
pages, only GET, hence why I have to implement the ApiController
CodePudding user response:
You can use LocalRedirect
:
public class YourController : Controller
{
puplic IActionResult GotToSomePage(string redirectUri)
{
//Your code
return LocalRedirect(redirectUri);
}
}