blazor-server-side

StateHasChanged() vs InvokeAsync(StateHasChanged) in Blazor

拟墨画扇 提交于 2021-02-20 09:32:25
问题 I know that calling the StateHasChanged() method notifies the component that the state has changed and that it should re-render. However, I also see calls to await InvokeAsync(StateHasChanged) or await InvokeAsync(() => StateHasChanged()) in other people's code, but I don't quite understand how it compares to StateHasChanged() and when should one be favored over the other, and why . The only information I could find was this part of the Blazor docs, it says: In the event a component must be

How to implement server side blazor Custom Authorization Provider Correctly

末鹿安然 提交于 2021-02-20 04:09:05
问题 I am trying to implement a basic custom Auth provider in my server side blazor project, but I am having some difficulty implementing the 'IsAuthenticating' property correctly. I used this site as my starter point, but it throws an error if ' IsAuthenticating ' is set to true (more specifically when I return null from GetAuthenticationStateAsync() ). https://gunnarpeipman.com/client-side-blazor-authorizeview/. Specifically this line of code: if(IsAuthenticating) { return null; <---- This line

How to implement server side blazor Custom Authorization Provider Correctly

不打扰是莪最后的温柔 提交于 2021-02-20 04:08:04
问题 I am trying to implement a basic custom Auth provider in my server side blazor project, but I am having some difficulty implementing the 'IsAuthenticating' property correctly. I used this site as my starter point, but it throws an error if ' IsAuthenticating ' is set to true (more specifically when I return null from GetAuthenticationStateAsync() ). https://gunnarpeipman.com/client-side-blazor-authorizeview/. Specifically this line of code: if(IsAuthenticating) { return null; <---- This line

How to implement server side blazor Custom Authorization Provider Correctly

馋奶兔 提交于 2021-02-20 04:08:01
问题 I am trying to implement a basic custom Auth provider in my server side blazor project, but I am having some difficulty implementing the 'IsAuthenticating' property correctly. I used this site as my starter point, but it throws an error if ' IsAuthenticating ' is set to true (more specifically when I return null from GetAuthenticationStateAsync() ). https://gunnarpeipman.com/client-side-blazor-authorizeview/. Specifically this line of code: if(IsAuthenticating) { return null; <---- This line

Blazor base-tag and @page instruction in .razor files

我的梦境 提交于 2021-02-16 14:29:57
问题 I am getting started with Blazor server-side and I don't get the routing right. I don't understand the need for the base tag in _host.cshtml . If I still have to add the base url in every Blazor component, for example: I want to have a base address of /app/ and the @page directive for the example Counter with a value of "/counter" does not "compile" to "/app/counter" . I have to set the @page to "/app/counter" which makes sense but that means that the base Tag in _host.cshtml is useless...

Blazor using Azure AD authentication allowing anonymous access

≯℡__Kan透↙ 提交于 2021-02-16 09:27:27
问题 I'm currently writing a (Server side) Blazor application that includes the default AzureAD Authentication. This works well for authenticated users - challenging on the entrance ( _Host.cshtml ) file, redirecting and then back once authenticated. I need to have a couple of pages not requiring authentication - I don't want the user being challenged and redirected to Microsoft. What is the correct way to do this? I have experimented with the AllowAnonymousAttribute , the AllowAnonymousToPage

Blazor using Azure AD authentication allowing anonymous access

不打扰是莪最后的温柔 提交于 2021-02-16 09:27:06
问题 I'm currently writing a (Server side) Blazor application that includes the default AzureAD Authentication. This works well for authenticated users - challenging on the entrance ( _Host.cshtml ) file, redirecting and then back once authenticated. I need to have a couple of pages not requiring authentication - I don't want the user being challenged and redirected to Microsoft. What is the correct way to do this? I have experimented with the AllowAnonymousAttribute , the AllowAnonymousToPage

Blazor - Securing using ADFS with local DB repository: how/when to hook into SQL

痞子三分冷 提交于 2021-02-11 13:38:17
问题 I have a Blazer Server app which now uses authentication from a local ADFS server. Having identified the user, I now need to load their permissions. We don't think this can be provided via claims from the ADFS server, so want to configure this in the DB, but need to understand how/when to get this information. Regarding the hook into ADFS, my code is as follows (any suggestions on improvement most welcome) App.razor <CascadingAuthenticationState> <Router AppAssembly="@typeof(Program).Assembly

What Is The Correct Way of Closing / Disconnecting An ASP.NET Core signalR Client Connection?

梦想与她 提交于 2021-02-11 13:12:49
问题 I am a new user struggling to close a secondary signalR client gracefully from an ASP.NET Core Blazor Server Page. I am setting up a secondary signalR client connection on first render of a Blazor Server Page. I am trying to close this secondary signalR client connection when the Page is closed via the browser tab. At the time of writing DisposeAsync does not seem to be triggered when the page is closed via the browser tab. However, the Dispose method IS triggered. Furthermore in Safari 13.0

What Is The Correct Way of Closing / Disconnecting An ASP.NET Core signalR Client Connection?

安稳与你 提交于 2021-02-11 13:12:16
问题 I am a new user struggling to close a secondary signalR client gracefully from an ASP.NET Core Blazor Server Page. I am setting up a secondary signalR client connection on first render of a Blazor Server Page. I am trying to close this secondary signalR client connection when the Page is closed via the browser tab. At the time of writing DisposeAsync does not seem to be triggered when the page is closed via the browser tab. However, the Dispose method IS triggered. Furthermore in Safari 13.0