blazor-client-side

Blazor Webassembly Authenticated Event

女生的网名这么多〃 提交于 2021-01-04 04:26:12
问题 When authenticating users with Microsoft.AspNetCore.Components.WebAssembly.Authentication, in a Blazor Webassembly application on the client side app that is hosted on ASP.NET Core (latest, blazor), when/how to call an action every time a user is authenticated? Even if they come back to the app and have an active session. Update 2020-07-15: The problem I am trying to overcome is that we have a service that goes to Graph API once a user logs in (MSAL) to get their info and profile image. After

Why does Blazor renders component twice

回眸只為那壹抹淺笑 提交于 2021-01-03 03:32:32
问题 I have a simple Blazor component. <div @onclick="HandleClick">Click me</div> @code { public async Task HandleClick() { await Task.Run(()=> System.Threading.Thread.Sleep(1000)); } protected override void OnAfterRender(bool firstRender) { Console.WriteLine("Rendered"); } } When I click on the div "Rendered" is printed to console and after 1 sec again which means that blazor has rendered component twice. I understand that Blazor triggers an automatic re-render of a component as part of

Why does Blazor renders component twice

早过忘川 提交于 2021-01-03 03:30:42
问题 I have a simple Blazor component. <div @onclick="HandleClick">Click me</div> @code { public async Task HandleClick() { await Task.Run(()=> System.Threading.Thread.Sleep(1000)); } protected override void OnAfterRender(bool firstRender) { Console.WriteLine("Rendered"); } } When I click on the div "Rendered" is printed to console and after 1 sec again which means that blazor has rendered component twice. I understand that Blazor triggers an automatic re-render of a component as part of

Why does Blazor renders component twice

随声附和 提交于 2021-01-03 03:30:24
问题 I have a simple Blazor component. <div @onclick="HandleClick">Click me</div> @code { public async Task HandleClick() { await Task.Run(()=> System.Threading.Thread.Sleep(1000)); } protected override void OnAfterRender(bool firstRender) { Console.WriteLine("Rendered"); } } When I click on the div "Rendered" is printed to console and after 1 sec again which means that blazor has rendered component twice. I understand that Blazor triggers an automatic re-render of a component as part of

The type or namespace IJSObjectReference could not be found

≯℡__Kan透↙ 提交于 2020-12-15 05:25:14
问题 I just started Blazor. I am trying to invoke a javascript function from a razor partial class. using Microsoft.JSInterop; public partial class Counter { [Inject] IJSRuntime js { get; set; } IJSObjectReference module; [JSInvokable] public async Task IncrementCount() { module = await js.InvokeAsync<IJSObjectReference>("import", "./js/Counter.js"); await module.InvokeVoidAsync("displayAlert", "New message"); } } I get the following error The type or namespace IJSObjectReference could not be

Blazor Startup Error: System.Threading.SynchronizationLockException: Cannot wait on monitors on this runtime

邮差的信 提交于 2020-12-13 04:09:35
问题 I am trying to call an api during the blazor(client side) startup to load language translations into the ILocalizer. At the point I try and get the .Result from the get request blazor throws the error in the title. This can replicated by calling this method in the program.cs private static void CalApi() { try { HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(@"https://dummy.restapiexample.com/api/v1/employees"); string path = "ididcontent.json"; string response =

Blazor Startup Error: System.Threading.SynchronizationLockException: Cannot wait on monitors on this runtime

心不动则不痛 提交于 2020-12-13 04:08:18
问题 I am trying to call an api during the blazor(client side) startup to load language translations into the ILocalizer. At the point I try and get the .Result from the get request blazor throws the error in the title. This can replicated by calling this method in the program.cs private static void CalApi() { try { HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(@"https://dummy.restapiexample.com/api/v1/employees"); string path = "ididcontent.json"; string response =

Blazor Startup Error: System.Threading.SynchronizationLockException: Cannot wait on monitors on this runtime

时光总嘲笑我的痴心妄想 提交于 2020-12-13 04:08:16
问题 I am trying to call an api during the blazor(client side) startup to load language translations into the ILocalizer. At the point I try and get the .Result from the get request blazor throws the error in the title. This can replicated by calling this method in the program.cs private static void CalApi() { try { HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri(@"https://dummy.restapiexample.com/api/v1/employees"); string path = "ididcontent.json"; string response =

How to authorize a Blazor WebAssembly SPA app using Identity Server

笑着哭i 提交于 2020-12-12 04:40:15
问题 I am writing a demo Blazor WebAssembly SPA technical demo app, but I have some problems with authentication. I'm going to use Identity Server to do the authorization but i can't find any libraries to support it. All the tutorials I found guided to use Blazor Server or add an ASP.net Core hosted, but it's not really make sense for my demo app. I am glad if anyone can help. Thank you 回答1: March 12th, 2020 To add OIDC to an existing Blazor WASM app using an existing OAuth identity provider read

How to authorize a Blazor WebAssembly SPA app using Identity Server

霸气de小男生 提交于 2020-12-12 04:38:32
问题 I am writing a demo Blazor WebAssembly SPA technical demo app, but I have some problems with authentication. I'm going to use Identity Server to do the authorization but i can't find any libraries to support it. All the tutorials I found guided to use Blazor Server or add an ASP.net Core hosted, but it's not really make sense for my demo app. I am glad if anyone can help. Thank you 回答1: March 12th, 2020 To add OIDC to an existing Blazor WASM app using an existing OAuth identity provider read