-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I created a template with InteractiveServer globally enabled in the VS Template (with no sample pages) as well as Individual Accounts enabled.
I navigate to /Account/Login with the chrome URL and press Enter. It works, I guess because it's a new request and HttpContext is possible to get this way.
When I create an a href="/Account/Login"-button in Home.razor - and pressing the button... It causes an exception because Login.razor OnInitialized method uses HttpContext without null-checking it (default!).
Note: Adding data-enhance-nav="false" in my a href in Home.razor doesn't work either.
Expected Behavior
I expect to navigate to Login with a href button without any exceptions.
Steps To Reproduce
- Create Blazor Web App
- Choose Individual Accounts
- Choose InteractiveServer
- Choose Globally
- Make an a href="/Account/Login"-button in Home.razor
- Press the button
- Exception occurs
Exceptions (if any)
System.NullReferenceException: 'Object reference not set to an instance of an object.'
BlazorApp14.Components.Pages.Account.Login.HttpContext.get returned null.
.NET Version
8.0.100-rc.2.23502.2
Anything else?
No response