blazor-server-side

Jwt Authentication doesn't work in Blazor Serverside

試著忘記壹切 提交于 2019-12-24 18:22:32
问题 I used Jwt authentication in a Blazor Client Hosted project with roles and everything (using Identity), But when I do the same thing in Blazor Server side It doesn't work, For example After I set the token in the Header: client.DefaultRequestHeaders.Add("Authorization", $"Bearer {Model.Token}"); Console.WriteLine($"Is authenticated = {httpContext.HttpContext.User.Identity.IsAuthenticated}"); IsAuthenticated returns false, and when I navigate to home page (to cause a refresh) the

Child Blazor app on Blazor Server side app

前提是你 提交于 2019-12-24 16:07:58
问题 Adding a Client side Blazor app to a Server Side Blazor app Hi Following on to the helpful answer here Blazor sub app 404 error after upgrade to Preview 6 I have run into a situation where it would be helpful to be able to add a Client side Blazor app to a Blazor server side app I have created the Blazor Server app, attached a client app the the server app, and adjusted the server startup.cs to map the child app. I have also confirmed the client apps index.html base value is correct app

Blazor: Access parameter from layout

时光毁灭记忆、已成空白 提交于 2019-12-24 15:28:54
问题 How can I access a page's route parameter from the layout? I have a page that accepts a route parameter like the following: @page /my-page/{Slug} I am needing to access the value of Slug when rendering markup in the shared layout. I have tried implementing OnParametersSet in the layout file like the following, but the value is not set. It's only assigned at the page level. @inherits LayoutComponentBase <div class="sidebar"> <NavMenu /> </div> <div class="main"> <div class="top-row px-4">

How to sign out over HttpContext in server-side Blazor

余生颓废 提交于 2019-12-24 11:18:22
问题 I access the HttpContext in a Blazor server-side view to manually log out. I added this line to Startup.cs: services.AddHttpContextAccessor(); and inject it in the view with @inject IHttpContextAccessor HttpContextAccessor . I've got a log out button which tries to execute this code: await HttpContextAccessor.HttpContext.SignOutAsync("Cookies"); but I get the following error message: System.InvalidOperationException: 'Headers are read-only, response has already started.' How can I prevent

How do I use blazor server-side inside a razor component library using areas?

☆樱花仙子☆ 提交于 2019-12-23 12:56:19
问题 I have an existing .net core 3.0 preview 7 web application . My application is mainly razor-pages organized into areas eg. Admin, Sales, etc. I am able to successfully use a blazor component if I put it at the root of the application, however, if I move the component to an RCL I can access the component but it is not responsive (clicking the button for the counter example does not increment the count). I want to be able to go localhost/Admin/RazorPageContainingBlazorComponent or localhost

Unable to determine the desired template from the input template name: blazorserverside

蓝咒 提交于 2019-12-22 06:24:31
问题 I am trying to setup blazor server side but I keep getting this problem when trying to install it following this tutorial from microsoft and I get this error in powershell window PS D:\blazorTesting> dotnet new blazorserverside -o WebApplicationServerSide Usage: new [options] Options: -h, --help Displays help for this command. -l, --list Lists templates containing the specified name. If no name is specified, lists all templates. -n, --name The name for the output being created. If no name is

Unable to determine the desired template from the input template name: blazorserverside

那年仲夏 提交于 2019-12-22 06:22:14
问题 I am trying to setup blazor server side but I keep getting this problem when trying to install it following this tutorial from microsoft and I get this error in powershell window PS D:\blazorTesting> dotnet new blazorserverside -o WebApplicationServerSide Usage: new [options] Options: -h, --help Displays help for this command. -l, --list Lists templates containing the specified name. If no name is specified, lists all templates. -n, --name The name for the output being created. If no name is

Unable to determine the desired template from the input template name: blazorserverside

穿精又带淫゛_ 提交于 2019-12-22 06:22:03
问题 I am trying to setup blazor server side but I keep getting this problem when trying to install it following this tutorial from microsoft and I get this error in powershell window PS D:\blazorTesting> dotnet new blazorserverside -o WebApplicationServerSide Usage: new [options] Options: -h, --help Displays help for this command. -l, --list Lists templates containing the specified name. If no name is specified, lists all templates. -n, --name The name for the output being created. If no name is

Adding Server-Side Blazor to an existing MVC Core app

久未见 提交于 2019-12-22 05:30:58
问题 I have a fully operative Blazor server-side project and a .NET Core 3 MVC project, both in the same solution. I'm now trying to use the components from the Blazor project in my MVC project. I've managed to get the components to render on an MVC page, but button clicks on the Blazor component don't trigger the onclick events for the components, instead I just get navigated to https://localhost:44341/? I'm unclear as to exactly what changes I need to make in the MVC solution to get this working

Using SignInManager in server-side Blazor

随声附和 提交于 2019-12-20 05:35:12
问题 Is it possible to use SignInManager without having some HTTPContext ? I'm making a Blazor server-side app and I need to make end-users signed in using PasswordSignInAsync() method of SignInManager . If there is other ways to do it with cookies or something else, I'll take it too, as long they are "clean" methods. If I could get also an explanation on how to configure for Startup.cs the solution, it will be perfect. 回答1: I'd strongly suggest that you use the Identity authentication system in