blazor-server-side

How do I get the access token from a blazor (server-side) web app?

六月ゝ 毕业季﹏ 提交于 2020-05-07 04:59:29
问题 After implementing openidconnect, where does blazor store the access token? how to retrieve it? How to add OpenIdConnect via IdentityServer4 to ASP.NET Core ServerSide Blazor web app? https://docs.microsoft.com/en-us/aspnet/core/security/blazor/?view=aspnetcore-3.1&tabs=visual-studio#customize-unauthorized-content-with-the-router-component 回答1: The following code snippets provide a way to retrieve the access token issued when a user is authenticated with IdentityServer4 provider. In order to

Navigating to Blazor page with parameter does not render layout or anything

半腔热情 提交于 2020-04-30 08:51:27
问题 So i created a page in Blazor application - it loads blog stories from database - loads a default one if none are picked - no big deal If I navigate to this page directly with the parameter id of a story - none of the Host or mainlayout - so none of the styling etc is applied or renders Page is https://www.pepclublocker.com/news-posts/1 if curious. What do i do to fix this? 回答1: The <base href="/" /> tag is missing in your html head , so Blazor look for script in /new-post and can't find

Navigating to Blazor page with parameter does not render layout or anything

时间秒杀一切 提交于 2020-04-30 08:48:30
问题 So i created a page in Blazor application - it loads blog stories from database - loads a default one if none are picked - no big deal If I navigate to this page directly with the parameter id of a story - none of the Host or mainlayout - so none of the styling etc is applied or renders Page is https://www.pepclublocker.com/news-posts/1 if curious. What do i do to fix this? 回答1: The <base href="/" /> tag is missing in your html head , so Blazor look for script in /new-post and can't find

Blazor, set home page to an html page

落花浮王杯 提交于 2020-04-30 06:45:52
问题 I have a blazor app, but it is divided in 2 parts. - a web site with several web pages - a Blazor Application By default, I wish to navigate to the "index.html" page. This one will have a "login" link that will redirect to the main application page. How can I do this... by default I'm directed to the index.cshtml (ie. the blazor app) ? 回答1: I wish to navigate to the "index.html" page. Assume you have put the index.html within the wwwroot/ folder, you could achieve that by registering a

Blazor, set home page to an html page

别来无恙 提交于 2020-04-30 06:44:06
问题 I have a blazor app, but it is divided in 2 parts. - a web site with several web pages - a Blazor Application By default, I wish to navigate to the "index.html" page. This one will have a "login" link that will redirect to the main application page. How can I do this... by default I'm directed to the index.cshtml (ie. the blazor app) ? 回答1: I wish to navigate to the "index.html" page. Assume you have put the index.html within the wwwroot/ folder, you could achieve that by registering a

Call this.StateHasChanged in EventHandler

不羁岁月 提交于 2020-04-30 06:38:46
问题 I have the following problem. I created an event and subscribe to it, now I want that the UI changes when the Event triggers. using System; using MintWebApp.Data; using MintWebApp.Models; using Microsoft.AspNetCore.Components; namespace WebApp.UI.Core { public partial class AppHeader { public string status { get; set; } [Inject] public StateService state { get; set; } EventHandler<string> onStatusChanged= (sender, eventArgs) => { //Here i get the error, I can't access this and status status =

Call this.StateHasChanged in EventHandler

孤街醉人 提交于 2020-04-30 06:38:07
问题 I have the following problem. I created an event and subscribe to it, now I want that the UI changes when the Event triggers. using System; using MintWebApp.Data; using MintWebApp.Models; using Microsoft.AspNetCore.Components; namespace WebApp.UI.Core { public partial class AppHeader { public string status { get; set; } [Inject] public StateService state { get; set; } EventHandler<string> onStatusChanged= (sender, eventArgs) => { //Here i get the error, I can't access this and status status =

How to add OpenIdConnect via IdentityServer4 to ASP.NET Core ServerSide Blazor web app?

感情迁移 提交于 2020-04-25 08:52:58
问题 I did the following (It should work but it does not), no redirect, no error, no nothing, it just displays the page without auth, what am I doing wrong? ASP.NET Core 3.1 Blazor Step 1. Install-Package Microsoft.AspNetCore.Authentication.OpenIdConnect Step 2. Edit Statup.cs Under "ConfigurationServices" add services.AddAuthentication(options => { options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme; options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme

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

Notify all clients of added student and update ui

风格不统一 提交于 2020-04-16 02:27:14
问题 I have a blazor web assembly project and a signal r service project I would like to invoke the changes to the ui when I add a student. Currently I have to refesh the page to see the addition. StudentService.cs public class StudentService { public HubConnection connection; public StudentServicen() { connection = new HubConnectionBuilder() .WithUrl(".../StudentsHub") .Build(); connection.StartAsync(); } public async Task<List<Students>> GetAllStudents() => await connection.InvokeAsync<List