Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor server error 400 fails to negotiate to server when using routing #20090

Closed
Kasper888 opened this issue Mar 23, 2020 · 2 comments
Closed

Comments

@Kasper888
Copy link

Blazor Routing Error

Describe the bug

As shown in the attached screenshot I'm using routing:

@page "/addbrand/{BrandId:guid}"

When I refresh the url https://localhost:44379/addBrand/1abc52f3-c371-4566-847d-1a986f093396 this lead to error 400 Failed to load resource as the url of balzor negotation changed to https://localhost:44379/addBrand/_blazor/negotiate?negotiateVersion=1 instead of
https://localhost:44379/_blazor/negotiate?negotiateVersion=1

https://localhost:44379/addBrand/_framework/blazor.server.js instead of
https://localhost:44379/_framework/blazor.server.js

and this happened to all of links in _host.cshtml file.

Got Exceptions? Yes, browser console log:
[2020-03-23T21:57:35.846Z] Information: Normalizing '_blazor' to 'https://localhost:44379/addBrand/_blazor'.
_blazor/negotiate?negotiateVersion=1:1 Failed to load resource: the server responded with a status of 400 ()
blazor.server.js:1 [2020-03-23T21:57:35.917Z] Error: Failed to complete negotiation with the server: Error

Further technical details

  • ASP.NET Core version: 3.1
  • The IDE: VS 2019
@Kasper888
Copy link
Author

Kasper888 commented Mar 24, 2020

Solved by set

<head>

    <base href="~/" />

</head>

@hakanaltindis
Copy link

thx for the answer. It worked for me.

@ghost ghost locked as resolved and limited conversation to collaborators May 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants