This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Description
/Pages/TestPage.cshtml
@page @functions { public IActionResult OnGet() { return RedirectToPage("/TestPage2", "Foo"); } }
/Pages/TestPage2.cshtml.cs
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; namespace WebApplication5.Pages { public class TestPage2Model : PageModel { public string Test { get; set; } = "DefaultHandler"; public IActionResult OnPost() { return RedirectToPage("/TestPage2", "Foo"); } public void OnGetFoo() { Test = "FooHandler"; } } }
/Pages/TestPage2.cshtml
@page "{handler?}" @model TestPage2Model <p>@Model.Test</p> <a asp-page="TestPage2" asp-page-handler="Foo">TestPage2Foo</a> <form method="POST"> <input type="submit" /> </form>
To reproduce this issue, take the following steps:
- Ensure the files listed above are in your MVC 2.0.0-preview2 project.
- Run the project and navigate to /TestPage
Expected Behavior:
/TestPage should redirect to /TestPage2/Foo, and the response body should contain "FooHandler".
Actual Behavior:
/TestPage redirects to just /TestPage, and the response body contains "DefaultHandler".
Note that if you submit the form on /TestPage2, the TestPage2.OnPost() handler is invoked and RedirectToPage("/TestPage2", "Foo") successfully redirects to /TestPage2/Foo which contains "FooHandler" as expected. The TestPage2Foo link also points to /TestPage2/Foo.