This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
Support finding "sibling" pages when using RedirectToPage and other URL generation sites with relative page names #6083
Labels
Projects
Milestone
Consider a pages folder layout:
To redirect from
Login.cshtml
toRegister.cshtml
a call like this is made:return RedirectToPage("/Account/Register");
. This requires knowledge of the full path to the desired page from the configured pages root.It would be nice to be able to redirect to pages in the same folder (sibling) without having to know the full page hierarchy like so:
return RedirectToPage("Register");
. Essentially, the page name passed here is assumed to relative to the current page if it's not qualified with a leading/
. If there is a named page with the same name, the sibling page would take precedence over the named page.This would make it possible to move hives of pages from one place to another and not have to update any of the URL-sensitive code or references within them.
Same logic would of course apply to anywhere we accept page names, e.g.
<a asp-page="Register">Click here to register</a>
@rynowak @pranavkm
The text was updated successfully, but these errors were encountered: