Comments (2)
Hi,
It's a strange situation because HttpContext.User
must have non-null value regardless authentication state. Have you made any changes in the project files? What environment do you use? Is httpContextAccessor
null or httpContextAccessor.HttpContext
is null?
from hybridblazor.
Hello,
in my local environment the whole thing ran without any problems and I can also reproduce your debugging result locally.
After deploying it on Azure, I became aware of the problem. Except for the database and some settings, I made no changes and deployed it 1 to 1.
After my research, see Stackoverflow Answer 1 with a small link in it to Stackoverflow Answer 2.
And there I found a link to the official documentation on this matter: Documentation Link
And in it the note that the HttpContext isn't guaranteed to be available within the IHttpContextAccessor, nor is it guaranteed to be holding the context that started the Blazor app.
The Blazor Server Starter via Visual Studio does not visibly access the httpcontext to query the user, but uses a helper method (RevalidatingServerAuthenticationStateProvider) to get our current user state. Maybe this is an approach to bypass the whole thing with the HttpContext?
from hybridblazor.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hybridblazor.