I\'m developing a web application using Asp.net core 2.0 with razor pages. I\'m creating an object with some data and want to send that object to another page.
Actua
The key here is that you need to pass an anonymous object whose property names match the routing constraints defined in the Razor Page.
For example, if you define an id (optional) routing constraint in the Razor Page:
@page "{id?}"
To redirect to that view passing a specific id, just do:
return RedirectToPage("PageName", new { id = 3 });
If you just one to redirect to the current page (but passing a specific id), just do:
return RedirectToPage(new { id = 3 });
If you just pass the number without the anonymous object it won't work.