How to pass the ReturnUrl from View to the following controller, Using Asp.MVc.Core.6
public IActionResult SetLanguage(string culture, string returnUrl)
{
var _returnUrl = returnUrl;
Response.Cookies.Append(
CookieRequestCultureProvider.DefaultCookieName,
CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture)),
new CookieOptions {Expires = DateTimeOffset.UtcNow.AddYears(1)}
);
if (Url.IsLocalUrl(returnUrl))
{
return Redirect(returnUrl);
return LocalRedirect(_returnUrl);
}
else
{
return RedirectToAction("Index", "Home");
}
}
The view
CodePudding user response:
You can simply use
asp-route-returnUrl="@Context.Request.Path"
It will do the trick