Skip to content
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

Closed
DamianEdwards opened this issue Apr 5, 2017 · 1 comment

Comments

@DamianEdwards
Copy link
Member

DamianEdwards commented Apr 5, 2017

Consider a pages folder layout:

~/
  /Pages
    Index.cshtml
    /Account
      Login.cshtml
      Register.cshtml

To redirect from Login.cshtml to Register.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

@rynowak
Copy link
Member

rynowak commented Apr 17, 2017

The decision here is to implement this in place of the page 'alias' feature. We'll punt aliases to future us.

@rynowak rynowak moved this from Design to Ready in Razor Pages 2.0.0-preview1 Apr 17, 2017
@rynowak rynowak moved this from Ready to Working in Razor Pages 2.0.0-preview1 Apr 21, 2017
@pranavkm pranavkm changed the title Support finding "sibling" pages when using RedirecToPage and other URL generation sites with relative page names Support finding "sibling" pages when using RedirectToPage and other URL generation sites with relative page names Apr 22, 2017
@pranavkm pranavkm moved this from Working to Done in Razor Pages 2.0.0-preview1 Apr 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

3 participants