blazor-server-side

HttpContext is NULL when running web app in IIS

自作多情 提交于 2020-07-28 20:25:22
问题 I have two application, both running on the same Windows machine. One application is IdentityServer4, and the other is my own web application (Server side Blazor app). Both web apps are build with .NET Core 3.1. When I navigate to my web app, I first get redirected to my IdentityServer4 app. I login, and after that I get redirected back to my web app. The login was successful, because there are no errors in the logs of IdentitServer. Also, I see a certain claim value on my Blazor webpage. I

HttpContext is NULL when running web app in IIS

大城市里の小女人 提交于 2020-07-28 20:23:09
问题 I have two application, both running on the same Windows machine. One application is IdentityServer4, and the other is my own web application (Server side Blazor app). Both web apps are build with .NET Core 3.1. When I navigate to my web app, I first get redirected to my IdentityServer4 app. I login, and after that I get redirected back to my web app. The login was successful, because there are no errors in the logs of IdentitServer. Also, I see a certain claim value on my Blazor webpage. I

Random “Error: The circuit failed to initialize” with Blazor app

社会主义新天地 提交于 2020-07-22 12:00:52
问题 I am currently developing a Blazor server side app and I am experiencing a random error directly after starting the page. When I hit the F5-button or click any link on my index page, the page is reloaded and the error does not appear again. The error message is very generic and I really don't know where to start to debug this. The error occurs even when I entirely remove the content of my Index.razor page, which is the starting page. Any ideas how to approach this problem? I'm running this on

Random “Error: The circuit failed to initialize” with Blazor app

前提是你 提交于 2020-07-22 12:00:33
问题 I am currently developing a Blazor server side app and I am experiencing a random error directly after starting the page. When I hit the F5-button or click any link on my index page, the page is reloaded and the error does not appear again. The error message is very generic and I really don't know where to start to debug this. The error occurs even when I entirely remove the content of my Index.razor page, which is the starting page. Any ideas how to approach this problem? I'm running this on

Blazor HttpClient 3.2.0 Get call throwing exception because response header content-type not compatible with GetFromJsonAsync

和自甴很熟 提交于 2020-07-22 06:08:36
问题 I am calling a webapi from a blazor 3.2.0 client: protected override async Task OnParametersSetAsync() { if (SelectedComplexId != Guid.Empty) { residents = await HttpClient.GetFromJsonAsync<List<ResidentDTO>>($"api/complex/residents/{SelectedComplexId.ToString()}"); } } An exception is being thrown because the GetFromJsonAsync expects a content-type header of application/json in response. This is the api action method: [HttpGet("/residents/{complexId}")] public async Task<IActionResult>

Blazor TwoWay Binding on custom Component

馋奶兔 提交于 2020-07-15 12:15:28
问题 I'm creating a blazor server side app and have problems to bind a value between two custom components. I've looked through different example of how the bind or @bind is supposed to work but I cannot figure out what up to date information on this matter is. Given a model class User: public class User { [Mapping(ColumnName = "short_id")] public string ShortId { get; set; } public User() { } } I want to build a form which displays all properties of this user and has them in an input so it can be

Blazor TwoWay Binding on custom Component

寵の児 提交于 2020-07-15 12:12:42
问题 I'm creating a blazor server side app and have problems to bind a value between two custom components. I've looked through different example of how the bind or @bind is supposed to work but I cannot figure out what up to date information on this matter is. Given a model class User: public class User { [Mapping(ColumnName = "short_id")] public string ShortId { get; set; } public User() { } } I want to build a form which displays all properties of this user and has them in an input so it can be

Why my Authentication State Provider not work?

血红的双手。 提交于 2020-07-09 14:34:26
问题 I use blazor with server side render and I want to do my own AuthenticationStateProvider, but it's not work and I do not know why. My ovveride method in public class LocalAuthenticationStateProvider : AuthenticationStateProvider : public async override Task<AuthenticationState> GetAuthenticationStateAsync() { if (await _storageService.ContainKeyAsync("User")) { var userInfo = await _storageService.GetItemAsync<LocalUserInfo>("User"); var claims = new[] { new Claim("Email", userInfo.Email),

Customizing the AuthenticationStateProvider in Blazor Server App with Jwt Token Authentication

做~自己de王妃 提交于 2020-07-02 03:05:39
问题 I've noticed that many developers subclass the AuthenticationStateProvider both in Blazor Server App and Blazor WebAssembly App wrongly, and more imprtantly for the wrong reasons. How to do it correctly and when ? 回答1: First off, you do not subclass the AuthenticationStateProvider for the sole purpose of adding claims to the ClaimPrincipal object. Generally speaking, claims are added after a user has been authenticated, and if you need to inspect those claims and tranform them, it should be

Customizing the AuthenticationStateProvider in Blazor Server App with Jwt Token Authentication

假装没事ソ 提交于 2020-07-02 03:05:38
问题 I've noticed that many developers subclass the AuthenticationStateProvider both in Blazor Server App and Blazor WebAssembly App wrongly, and more imprtantly for the wrong reasons. How to do it correctly and when ? 回答1: First off, you do not subclass the AuthenticationStateProvider for the sole purpose of adding claims to the ClaimPrincipal object. Generally speaking, claims are added after a user has been authenticated, and if you need to inspect those claims and tranform them, it should be