Most likely the OnGetRedirectToPage() handler is not executing. You did not share how TestModel is called Assuming TestModel is in the root, the URL would be...
<a href=/Test?handler=RedirectToPage>Call Redirect</a>
public class TestModel : PageModel
{
public void OnGet()
{
}
public IActionResult OnGetRedirectToPage()
{
return RedirectToPage("/Privacy");
}
}
@page
@model RazorPagesDemo.Pages.TestModel
<a asp-page-handler="RedirectToPage">Redirect</a>
https://www.learnrazorpages.com/razor-pages/handler-methods
https://www.mikesdotnetting.com/article/308/razor-pages-understanding-handler-methods
https://learn.microsoft.com/en-us/aspnet/core/razor-pages/?view=aspnetcore-7.0&tabs=visual-studio