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

How Can I Create Dynamic Base Path In Blazor

$
0
0

I have a blazor application in .NET 8. My App.razor file like below;

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><base href="/" /><link rel="stylesheet" href="bootstrap/bootstrap.min.css" /><link rel="stylesheet" href="app.css" />    <link rel="icon" type="image/png" href="favicon.png" /><HeadOutlet /></head><body><Routes /><script src="_framework/blazor.web.js"></script></body></html>

When running locally, bootstrap files and all redirects work successfully. However, In the test environment, the bootstrap files cannot be accessed because my application opens with an address like test.blabla.com/appname in the test environment.

I am expecting search bootstrap files under test.blabla.com/appname/bootstrap/bootstrap.min.css but it does not search in this adress it search test.blabla.com/bootstrap/bootstrap.min.css so it cannot find.

I tried using <base href="~/" /> and<base href="@NavigationManager.BaseUri" /> instead of <base href="/" /> but it didn't work. By typing <base href="appname/" /> the problem is solved, but this time it gets an error locally. How can I solve this problem?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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