/// <summary>
        /// Creates a <see cref="RedirectResult"/> object that redirects to the specified url
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="url">The URL to redirect to.</param>
        /// <param name="escapeUrl">Whether to escape the url.</param>
        public static ActionResult Redirect(this Controller controller, string url, bool escapeUrl)
        {
            if (!escapeUrl)
            {
                return(controller.Redirect(url));
            }

            return(controller.Redirect(url.ToUriComponents()));
        }
Exemple #2
0
 public static IActionResult RedirectToReferrer(
     this Controller controller) => controller.Redirect(controller.Request.GetReferrer());