blazor

Could not find property of window when doing JS interop with Blazor

不问归期 提交于 2021-02-20 19:09:34
问题 Hello i am trying to call a method from a js file from Blazor . My file structure is like this: -root -JSInterop.cs -js(folder) -meth.js (file containing the js method) I keep getting the following error : Could not find 'methods' in 'window'. **Cs class that calls the js ** public class JSInterop { public static async Task<string> ChangeText() { try { var data = await JSRuntime.Current.InvokeAsync<string>("./js/meth/methods.print","mymessage"); Console.WriteLine($"ReturnedFromJS:{data}");

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

Deploy Blazor WebAssembly App ASP.NET Core hosted to Azure

怎甘沉沦 提交于 2021-02-20 05:20:08
问题 I have a 3-projects solution structure (Client,Server,Shared) in Visual Studio 2019. What I exactly did to create it can be described as: [GUI] BlazorApp -> Blazor WebAssembly App -> checbox ticked [v] ASP.NET Core hosted which is equal to: [CMD] dotnet new blazorwasm --hosted I would like to deploy this projects to Azure , but I am facing some problems: When I tried to use continous GitHub deploy and attached my branch to it, I got error which basically said that 3.1 version is not supported

Deploy Blazor WebAssembly App ASP.NET Core hosted to Azure

坚强是说给别人听的谎言 提交于 2021-02-20 05:19:25
问题 I have a 3-projects solution structure (Client,Server,Shared) in Visual Studio 2019. What I exactly did to create it can be described as: [GUI] BlazorApp -> Blazor WebAssembly App -> checbox ticked [v] ASP.NET Core hosted which is equal to: [CMD] dotnet new blazorwasm --hosted I would like to deploy this projects to Azure , but I am facing some problems: When I tried to use continous GitHub deploy and attached my branch to it, I got error which basically said that 3.1 version is not supported

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 select bind to a value in a list [duplicate]

半腔热情 提交于 2021-02-19 08:43:10
问题 This question already has answers here : blazor variable argument passing to onclick function (2 answers) Closed last year . I was able to bind an int type (which is the first element of the list SelectedDiagnosisIdList) variable to the selected element of a html select: <div> <label>Diagnosis:</label> <div> <select @bind="@userInfo.SelectedDiagnosisIdList[0]"> @foreach (var item in diagnoses) { <option value="@item.Id">@item.Name</option> } </select> <p>@userInfo.SelectedDiagnosisIdList[0]"<

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