blazor

Accessinging an authenticated user outside of a view in Blazor

懵懂的女人 提交于 2020-03-02 19:33:49
问题 In my server side Blazor app, the authentication is being handled in a very unconventional way. Essentially, when a user visits the page they are authenticated using their windows credentials. At that point, a custom policy is created to look up that username in an external database (Informix) in which the authorization for that user in the application is found. Specifically for each level of authorization in the app (can update, go to this page, etc.), I am creating a new claim to add to the

Accessinging an authenticated user outside of a view in Blazor

半城伤御伤魂 提交于 2020-03-02 19:32:24
问题 In my server side Blazor app, the authentication is being handled in a very unconventional way. Essentially, when a user visits the page they are authenticated using their windows credentials. At that point, a custom policy is created to look up that username in an external database (Informix) in which the authorization for that user in the application is found. Specifically for each level of authorization in the app (can update, go to this page, etc.), I am creating a new claim to add to the

blazor variable argument passing to onclick function

我的梦境 提交于 2020-02-25 21:26:29
问题 I want to pass the int i into the button onclick function for each list item. I expected the "clickItem" function will receive 0..2 for correspondig list item. But it come out that it always receive 3 as argument. It seems that the variable i in the clickItem(i) is not evaluated at the time of render of the for loop. I have tried changing it to "clickItem(@i)" but it is still the same. What should I do? (I am using blazor server side, .net core 3 preview 5) @for (int i = 0; i < 3; i++) { <li>

blazor httpClient.PostJsonAsync status code exception

时光毁灭记忆、已成空白 提交于 2020-02-25 09:44:07
问题 When using the HTTP in Blazor client side it only works if the response is a success response, but if it is not found or bad response it gives exception and doesn't complete the code. I want to parse the object I send in the response even if the request is not successful I mean 400 or 404, I send an object with error list so I need to get it. It gives me error in the console that the request is not successful. If I make the request to be (OK) then it works, but I need to send 400 status with

.Net Core Blazor - Javascript error using input checkbox binding with <tr> onclick

房东的猫 提交于 2020-02-25 07:05:52
问题 I am writing a Blazor component for a Blazor server side app, that will display a table of data and allow one or more rows to be selected. The idea is that there will be a checkbox in the first column of the table and the row data in the remaining columns. The row is selected/deselected by clicking the checkbox OR by clicking anywhere in the row. This is done by binding an input checkbox to a bool on the row object and by using onclick on the tr element. <tr @onclick="() => item.Toggle()">

How to enable .NET Core 3 preview SDK in VS2019?

血红的双手。 提交于 2020-02-23 09:11:33
问题 I wanted to try out Blazor. I've installed .NET Core 3.0 preview 5 SDK, Blazor VS extension to enable project templates. I can create Blazor project, but I can't run it - I constantly get this notification. In some tutorials I see that there should be a checkbox in VS options - to enable using of preview SDKs. But it's not there in VS2019! Version is 16.1.1 回答1: Thanks to @Kirk Woll. They moved this checkbox indeed. 回答2: If you are using the preview channel for vs 2019 then it is on by

How to enable .NET Core 3 preview SDK in VS2019?

扶醉桌前 提交于 2020-02-23 09:11:08
问题 I wanted to try out Blazor. I've installed .NET Core 3.0 preview 5 SDK, Blazor VS extension to enable project templates. I can create Blazor project, but I can't run it - I constantly get this notification. In some tutorials I see that there should be a checkbox in VS options - to enable using of preview SDKs. But it's not there in VS2019! Version is 16.1.1 回答1: Thanks to @Kirk Woll. They moved this checkbox indeed. 回答2: If you are using the preview channel for vs 2019 then it is on by

Blazor onchange event with select dropdown

ⅰ亾dé卋堺 提交于 2020-02-23 08:45:52
问题 So i have been stuck trying to get a simple onchange to fire when a select dropdown value changes. Like so: <select class="form-control d-flex" onchange="(dostuff())"> @foreach (var template in templatestate.templates) { <option value=@template.Name>@template.Name</option> } </select> with the method being called: void dostuff() { Console.WriteLine("first spot is firing"); _template = templatestate.templates.FirstOrDefault(x => x.Name == _template.Name); Console.WriteLine("second spot is

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

Is it safe to call StateHasChanged() from an arbitrary thread?

别说谁变了你拦得住时间么 提交于 2020-02-20 07:12:48
问题 Is it safe to call StateHasChanged() from an arbitrary thread? Let me give you some context. Imagine a Server-side Blazor/Razor Components application where you have: A singleton service NewsProvider that raises BreakingNews events from an arbitrary thread. A component News.cshtml that gets the service injected and subscribes to BreakingNews event. When the event is raised, the component updates the model and calls StateHashChanged() NewsProvider.cs using System; using System.Threading;