.NET 9 / Razor pages: When using Url.Page method how can I avoid that current parameters are automatically added to the generated URL?
06:39 12 Nov 2025

I have an ASP.NET (.NET 9) Razor pages application.

In my application I generate navigation URLs using Url.Page method.

However if I'm currently on a page which has additional parameters (for example /Report/2025/10) then the Url.Page("Report") will return /Report/2025/10.

I would like to get the 'clean' URL: (/Report) without current parameters.

Is this possible? I've tried setting the values parameter to null or empty object (new {}) but it seems to be ignoring this.

Note: my parameters are optional so the page will work even without them

asp.net-core razor-pages .net-9.0