blazor-client-side

Blazor Adding HttpClientHandler to add Jwt to HTTP Header on requests

泪湿孤枕 提交于 2020-05-15 04:08:51
问题 I am using the Visual Studio 2019 and .Net Core 3.0.0-preview-7 with the standard Blazor Client, Server and Shared templates. In the application our server side WebApi application will always require a JWT token to be present in the header for authorization. From looking at the following Make HTTP requests using IHttpClientFactory in ASP.NET Core I created the following handler; public class JwtTokenHeaderHandler : DelegatingHandler { private readonly ILocalStorageService _localStorage;

Blazor Adding HttpClientHandler to add Jwt to HTTP Header on requests

点点圈 提交于 2020-05-15 04:03:11
问题 I am using the Visual Studio 2019 and .Net Core 3.0.0-preview-7 with the standard Blazor Client, Server and Shared templates. In the application our server side WebApi application will always require a JWT token to be present in the header for authorization. From looking at the following Make HTTP requests using IHttpClientFactory in ASP.NET Core I created the following handler; public class JwtTokenHeaderHandler : DelegatingHandler { private readonly ILocalStorageService _localStorage;

Blazor EditContext doesn't trigger FieldState

心已入冬 提交于 2020-05-12 07:18:19
问题 When values change in the Form Component. The Editform does not validate and it does not set the IsModified of the FieldState to true. Only on submit it will validate. I see when the values change, the class "Modified" is not added the input tag in HTML. So it looks like the EditContext is not setting the FieldState? How can I achieve that? Many thanks! Code (Simplified): Form Component @typeparam TItem <EditForm EditContext="_editContext" OnValidSubmit="OnValidSumit">

c# blazor how to pass a List to a page

99封情书 提交于 2020-04-17 20:37:11
问题 I have a second page that receives the following parameter: @page "/newrecord/{Employees}" @inject HttpClient http <h1>@Employees.Count</h1> @code { [Parameter] public List<Model.Employees> Employees{ get; set; } } On my main page Im passing the list when clicking a button like this: List<Model.Employees> selected { get; set; } private void OnAddRecord() { NavigationManager.NavigateTo($"newrecord/{this.selected}"); } When the button is clicked I get an error and I can see the URL is being

System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.'

▼魔方 西西 提交于 2020-04-07 07:09:51
问题 I've download new blazor webassembly project template with dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3 Next I created in Visual Studio 2019 new Blazor WebAssembly project with enabled "Asp.Net Core hosted" and "authenthication". I named it "27MarchTemplate" Now I Run project and get System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.' at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.get

System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.'

我的梦境 提交于 2020-04-07 07:08:47
问题 I've download new blazor webassembly project template with dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3 Next I created in Visual Studio 2019 new Blazor WebAssembly project with enabled "Asp.Net Core hosted" and "authenthication". I named it "27MarchTemplate" Now I Run project and get System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.' at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.get

System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.'

寵の児 提交于 2020-04-07 07:08:00
问题 I've download new blazor webassembly project template with dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3 Next I created in Visual Studio 2019 new Blazor WebAssembly project with enabled "Asp.Net Core hosted" and "authenthication". I named it "27MarchTemplate" Now I Run project and get System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.' at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.get

System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.'

余生颓废 提交于 2020-04-07 07:07:22
问题 I've download new blazor webassembly project template with dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3 Next I created in Visual Studio 2019 new Blazor WebAssembly project with enabled "Asp.Net Core hosted" and "authenthication". I named it "27MarchTemplate" Now I Run project and get System.InvalidOperationException: 'Client '27MarchTemplate.Client' not found.' at Microsoft.AspNetCore.ApiAuthorization.IdentityServer.ClientCollection.get

Found markup element with unexpected name 'Cascading AuthenticationState'

那年仲夏 提交于 2020-02-20 08:36:27
问题 I am getting this error on my App.razor: Found markup element with unexpected name 'CascadingAuthenticationState'. If this is intended to be a component, add a @using directive for it namespace This is the code I am using <CascadingAuthenticationState> <Router AppAssembly="@typeof(Program).Assembly"> <Found Context="routeData"> <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> </Found> <NotFound> <LayoutView Layout="@typeof(MainLayout)"> <p>Sorry, there's nothing at

How to obtain the target element on click event in Blazor

烈酒焚心 提交于 2020-02-03 11:02:09
问题 I want the exact target on which the click event has been triggered in ASP.NET Core blazor. Is this achievable? 回答1: You can use @ref to get a reference to a DOM object, then pass it as a parameter to your handler function. You can then pass it as a parameter to the JS Interop. For example: Counter.razor @page "/counter" @using Microsoft.JSInterop @inject IJSRuntime JSRuntime <h1>Counter</h1> <p>Current count: @currentCount</p> <p>Last button clicked: @lastButtonClicked</p> <button @ref