Skip to content

Add Html.AntiForgeryToken in the _ShellLayout.cshtml file #140

@brangebrange

Description

@brangebrange

Hi,

We are using the Geta-optimizely-sitemaps plugin in our latest project, we started encountering multiple 500 errors from the navigation.bundle.js script on a site that uses Opti ID.

After some investigation, it appears that the _ShellLayout.cshtml file located at src/Geta.Optimizely.Sitemaps/Geta.Optimizely.Sitemaps.Views/Views/Shared/_ShellLayout.cshtml is missing a line. Specifically, there should be an @Html.AntiForgeryToken() line before the @Html.CreatePlatformNavigationMenu() line.

If you check this blog post: https://world.optimizely.com/blogs/matthew-slim/dates/2023/6/new-menu-system-released and read the comments, you’ll find a solution for this issue.

Example: 
<body>
@Html.AntiForgeryToken()
@Html.CreatePlatformNavigationMenu()
 <div @Html.ApplyPlatformNavigation()>
....rest of code

There’s also another blog post describing the same problem: https://world.optimizely.com/blogs/allthingsopti/dates/2025/10/a-day-in-the-life-of-an-optimizely-omvp---creating-a-blazor-add-on/

Best regards,
Anders

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions