Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to add url segment automatically using baseref?

$
0
0

I have a Blazor server-side app and I added the following in _Host.cshtml:

<base href="~/Sub" />

I also changed the launchsettings.json:

{"iisSettings": {"windowsAuthentication": false,"anonymousAuthentication": true,"iisExpress": {"applicationUrl": "http://localhost:58014/Sub","sslPort": 44309    }  },"profiles": {"IIS Express": {"commandName": "IISExpress","launchBrowser": true,"environmentVariables": {"ASPNETCORE_ENVIRONMENT": "Development"      }    }  }}

My entry point is Home.razor with the following attribute:

@page "/"

I use either an anchor tag, NavLink or the NavigationManager to go to other pages, for example:

<li class="nav-item"><a class="nav-link" target="_self" href="/">Home</a></li>

or:

navigationManager.NavigateTo("/", true, true);

However the base ref is being ignored.

How can I make sure that the navigation automatically includes the base ref defined?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>