blazor-server-side

Calling async methods in Blazor view

空扰寡人 提交于 2020-05-23 10:03:51
问题 I have a server-side blazor client and I'm trying to modify the MainLayout razor page by having a Login check. I'm currently using Blazored for localstorage saving, and I'm currently using to see if a token is saved to see if user is logged in, however I'm not sure how I translate this in the if statement in razor page because it wants async method. My login check is pretty simple as shown below. public async Task<bool> IsLoggedIn() { return await m_localStorage.ContainKeyAsync("token")

Calling async methods in Blazor view

南楼画角 提交于 2020-05-23 10:03:23
问题 I have a server-side blazor client and I'm trying to modify the MainLayout razor page by having a Login check. I'm currently using Blazored for localstorage saving, and I'm currently using to see if a token is saved to see if user is logged in, however I'm not sure how I translate this in the if statement in razor page because it wants async method. My login check is pretty simple as shown below. public async Task<bool> IsLoggedIn() { return await m_localStorage.ContainKeyAsync("token")

How to hook into AuthorizationCodeReceived when using AddAzureADB2C?

落爺英雄遲暮 提交于 2020-05-17 08:25:52
问题 I've created a simple Blazor server application linking to an Azure B2C directory for authorization. Everything works but I need to add additional role claims to the token. Research has pointed me to this SO post which refers to adding the claims during the AuthorizationCodeReceived notification(Example here). I understand what I need to do, but the example is using OpenIdConnectAuthentication (from Microsoft.Owin.Security.OpenIdConnect ) instead of Blazor server's Microsoft.AspNetCore

Server-side Blazor page post to Razor page http error 400

只谈情不闲聊 提交于 2020-05-16 12:31:42
问题 I am trying to post my username and password from a Blazor page (.razor) to a Razor Page(.cshtml) but I get http error 400 all the time. LoginControl.razor <form method="post" action="login"> <input type="text" name="username" @bind="@Username" placeholder="User Name" />    <input type="password" name="password" placeholder="Password" @bind="@Password" />    <button class="ml-md-auto btn btn-primary">Loggin</button> </form> Login.cshtml.cs public async Task<IActionResult> OnPostAsync(

Server-side Blazor page post to Razor page http error 400

别来无恙 提交于 2020-05-16 12:31:24
问题 I am trying to post my username and password from a Blazor page (.razor) to a Razor Page(.cshtml) but I get http error 400 all the time. LoginControl.razor <form method="post" action="login"> <input type="text" name="username" @bind="@Username" placeholder="User Name" />    <input type="password" name="password" placeholder="Password" @bind="@Password" />    <button class="ml-md-auto btn btn-primary">Loggin</button> </form> Login.cshtml.cs public async Task<IActionResult> OnPostAsync(

onChange event not firing Blazor InputSelect

有些话、适合烂在心里 提交于 2020-05-16 03:21:15
问题 I have the following Code for an InputSelect <InputSelect class="form-control form-control form-control-sm" placeholder="Role" disabled="@IsReadOnly" @bind-Value="Model.Role" @onchange="@RoleChanged"> <option value="Member">Member</option> <option value="Admin">Admin</option> <option value="Pioner">Pioneer</option> <option value="Retailer">Retailer</option> </InputSelect> And for the Code: bool ShowCreated; bool ShowUpdated; bool IsReadOnly; string SelectedRole; public EditForm AccountForm;

onChange event not firing Blazor InputSelect

天涯浪子 提交于 2020-05-16 03:21:06
问题 I have the following Code for an InputSelect <InputSelect class="form-control form-control form-control-sm" placeholder="Role" disabled="@IsReadOnly" @bind-Value="Model.Role" @onchange="@RoleChanged"> <option value="Member">Member</option> <option value="Admin">Admin</option> <option value="Pioner">Pioneer</option> <option value="Retailer">Retailer</option> </InputSelect> And for the Code: bool ShowCreated; bool ShowUpdated; bool IsReadOnly; string SelectedRole; public EditForm AccountForm;

Blazor on server-side: using MongoDB for Identity management

淺唱寂寞╮ 提交于 2020-05-15 04:15:26
问题 The Asp.Net Core Blazor template in VS 2019 can create a server-side app that will use the Microsoft SQL Server to manage the accounts and claims for identity management. I would like to use MongoDB instead for account and claims management. This way I want to enable Blazor to use decorators and AuthorizeView to allow specific access for specific identities or claims. I have scaffolded the Identity construct but I am confused how to proceed. There is an open source Identity provider available

Blazor on server-side: using MongoDB for Identity management

有些话、适合烂在心里 提交于 2020-05-15 04:14:02
问题 The Asp.Net Core Blazor template in VS 2019 can create a server-side app that will use the Microsoft SQL Server to manage the accounts and claims for identity management. I would like to use MongoDB instead for account and claims management. This way I want to enable Blazor to use decorators and AuthorizeView to allow specific access for specific identities or claims. I have scaffolded the Identity construct but I am confused how to proceed. There is an open source Identity provider available

ASP.Net Core Blazor: How to load different _Host.cshtml files based on header value

不想你离开。 提交于 2020-05-13 19:24:08
问题 I would like to load a _Host.cshtml file in an ASP.NET Core Blazor project (Server side Blazor) based on a header in the request. For example: A client connects to example.com and is redirected to a _Host.cshtml file specific for tenant A. Another client connects to test.com and is redirected to a _Host.cshtml file specific for tenant B. The _Host.cshtml file looks somehow like this: @page @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers <!DOCTYPE html> <html lang="en" dir="ltr"> <head>