diff --git a/Project/Project/Controllers/ReviewController.cs b/Project/Project/Controllers/ReviewController.cs index c8db440..e188f4b 100644 --- a/Project/Project/Controllers/ReviewController.cs +++ b/Project/Project/Controllers/ReviewController.cs @@ -132,17 +132,7 @@ public async Task Delete(string movieId, string route) } else { TempData["SuccessMessage"] = "Review has been successfully deleted."; - var refererUrl = Request.Headers["Referer"].ToString(); - var allowedUrls = new List { "/home", "/profile", "/reviews" }; // Add your allowed URLs here - var uri = new Uri(refererUrl, UriKind.RelativeOrAbsolute); - if (!uri.IsAbsoluteUri && allowedUrls.Contains(uri.LocalPath)) - { - return Redirect(refererUrl); - } - else - { - return RedirectToAction("Index", "Home"); - } + return Redirect(Request.Headers["Referer"].ToString()); } } else @@ -152,19 +142,10 @@ public async Task Delete(string movieId, string route) return Json(new { success = false, redirectToLogin = true, message = "User not logged in." }); } else { - var refererUrl = Request.Headers["Referer"].ToString(); - var allowedUrls = new List { "/home", "/profile", "/reviews" }; // Add your allowed URLs here - var uri = new Uri(refererUrl, UriKind.RelativeOrAbsolute); - var returnUrl = (!uri.IsAbsoluteUri && allowedUrls.Contains(uri.LocalPath)) ? refererUrl : Url.Action("Index", "Home"); - return RedirectToAction("Login", "Auth", new { returnUrl = returnUrl }); + var originalUrl = Request.Headers["Referer"].ToString(); + return RedirectToAction("Login", "Auth", new { returnUrl = originalUrl }); } } } } -} - - - - - - +} \ No newline at end of file