Open Closed

Home url auto added "/#" after upgraded to v10 #10196


User avatar
0
hanntd created

Hi, My solution is Blazor Server. After upgrade to v10 when clicked on Home menu from the left side bar the url auto added "/#", it still navigate to Home correctly but affected to some our custom code. How to prevent it added "/#". I tried to create a new Blazor Server solution from v10 and have the same issue.

Thanks, Dharma


8 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    1. Solution
    • What you’re seeing is the hash (“/#”) at the end of the URL when clicking the “Home” menu item in Blazor Server after upgrading to ABP v10. This comes from the menu item’s Url being empty (or “/”) while the rendered anchor uses a fallback “#” (hash) to avoid navigation. In ABP v10’s LeptonX Blazor menu component, a leaf item with a null/empty Url is rendered with “#”, which changes the browser URL to “/#” but still keeps you on the home page.
    • Fix options:
      1. Set an explicit Url for the Home menu item to “/” (root), so the anchor doesn’t fall back to “#”.
        • If you add Home via menu contributor:
    context.Menu.AddItem(
             new ApplicationMenuItem(
               "MyHome",
               "Home",
               url: "/",
               icon: "fa fa-home",
               order: 0
             )
           );
    
     - If you customize the built-in Home item, ensure its Url is “/” (not null/empty).
    
    1. If you have customized the LeptonX side menu component (MainMenuItem.razor) and kept the fallback behavior, adjust it so that the fallback uses “/” instead of “#”:
    var url = string.IsNullOrWhiteSpace(MenuItem.MenuItem.Url)
           ? "/"
           : MenuItem.MenuItem.Url.TrimStart('/', '~');
    
    1. If you do not explicitly register a Home item, create one with Url “/” so navigation uses a proper path instead of hash.
    • After the change, restart the app and verify that clicking “Home” results in “https://localhost:port/” (no “/#”), and your custom code relying on clean URLs will work again.
    1. Sources
    • Blazor UI routing basics (ABP uses Blazor’s router): https://abp.io/docs/latest/framework/ui/blazor/routing

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    hanntd created

    My Home was added from menu contributor: context.Menu.AddItem(new ApplicationMenuItem( XspireMenus.Home, l["Menu:Home"], "/", icon: "fas fa-home", order: 1 ));

  • User Avatar
    0
    hanntd created

    your AI suggestion not is the solution for me

  • User Avatar
    0
    hanntd created

    it is not the solution, the issue still existing

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi @hanntd

    I will check it.

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    We will change this behavior in the next version. You can use a new route for home

    eg: /Home instead of /

    Thanks

  • User Avatar
    0
    hanntd created

    thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    : )

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 11, 2025, 13:20
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.