I can't believe I cannot find any solution to this. For business reason, RedirectToAction or anything won't do because it causes a HTTP 302 to be returned. An example:
public async Task<IActionResult> GoogleLoginCallback(GoogleLoginCallbackViewModel requestModel) { if (requestModel == null || !requestModel.Error.IsNullOrEmpty()) { // Return something here // to process at Login Action instead // maybe with Error data passed } // Normal processing } The nearest I can find is this post using TransferResult but:
- It seems ugly to me.
- Does not work for ASP.NET Core.
Is there anyway to transfer the request to another Route/Action without returning a HTTP Redirection?