[ACCEPTED]-How to navigate to an ASP.NET Core MVC controller in Blazor app?-blazor

Accepted answer
Score: 11

This should do:

@page "/MvcLinkExample"
@inject NavigationManager NavigationManager

<button @onclick="NavigateToMvcPage">MVC Link</button>

@code {
    private void NavigateToMvcPage()
        NavigationManager.NavigateTo("controllername/actionname/10", true);


Score: 0

MVC uses "routes" to configure endpoints 6 (Controller / Action / Area) mappings.

In 5 the example you provided, the route would 4 resolve to http(s)://[hostname or ip]/Download/DownloadFile/.

With 3 the "default route", the 'key' query string 2 param can be provided via ?key=[value-xxx] as 1 a basic implementation.

More Related questions