How to redirect to a asp.net core razor page (no routes)
@Roman Pokrovskij This might be way too much old but if you want to redirect to an Area you should:
return RedirectToPage ( "/Page", new { Area = "AreaName" } );
check out the MS page https://docs.microsoft.com/en-us/aspnet/core/mvc/razor-pages/?tabs=visual-studio
The associations of URL paths to pages are determined by the page's location in the file system. The following table shows a Razor Page path and the matching URL:
File name path matching URL --------------------------- ---------------------- /Pages/Index.cshtml / or /Index /Pages/Contact.cshtml /Contact /Pages/Store/Contact.cshtml /Store/Contact /Pages/Store/Index.cshtml /Store or /Store/Index
URL generation for pages supports relative names. The following table shows which Index page is selected with different RedirectToPage parameters from Pages/Customers/Create.cshtml:
RedirectToPage(x) Page ------------------------ --------------------- RedirectToPage("/Index") Pages/Index RedirectToPage("./Index"); Pages/Customers/Index RedirectToPage("../Index") Pages/Index RedirectToPage("Index") Pages/Customers/Index