asp-net-core-spa-services

Using string.Split() in AutoMapper issue

一曲冷凌霜 提交于 2021-02-20 19:12:51
问题 I have an ASP .Net core application. I am simply trying to have my AutoMapper configure to convert a string comma delimited into a list of strings as per this configuration: configuration.CreateMap<Job, JobDto>() .ForMember(dto => dto.Keywords, options => options.MapFrom(entity => entity.Keywords.Split(',').ToList())) For some reason it does not get compiled and give me the following error: An expression tree may not contain a call or invocation that uses optional argument I can't see why I

Trying to serve Index.html in ASP.NET Core project and /api/values elsewhere

╄→尐↘猪︶ㄣ 提交于 2020-06-17 00:59:33
问题 I've got a SPA app that I've loaded into my /wwwroot directory and it has an index.html file that I want loaded by default. I then want the normal controller files to work. That is the default values controller should run. Below is my startup. It does render wwwroot/index.html but then /api/values does not work (unless I comment out UseStaticFiles, then index.html does not). How can I get both index.html to load and also the values controller to work. startup.cs public void Configure(

IdentityServer4 authenticate each client separately

帅比萌擦擦* 提交于 2020-01-13 19:29:50
问题 I use two different clients. The IdentityServer4 provides API protections and log in form. Can I configure clients to avoid single sign on. I mean that even if I logged in the first client I need to log in the second client too. My ID4 configuration: internal static IEnumerable<Client> GetClients(IEnumerable<RegisteredClient> clients) { return clients.Select(x => { var scopes = x.AllowedScopes.ToList(); scopes.Add(IdentityServerConstants.StandardScopes.OpenId); scopes.Add

IdentityServer4 authenticate each client separately

不想你离开。 提交于 2020-01-13 19:29:11
问题 I use two different clients. The IdentityServer4 provides API protections and log in form. Can I configure clients to avoid single sign on. I mean that even if I logged in the first client I need to log in the second client too. My ID4 configuration: internal static IEnumerable<Client> GetClients(IEnumerable<RegisteredClient> clients) { return clients.Select(x => { var scopes = x.AllowedScopes.ToList(); scopes.Add(IdentityServerConstants.StandardScopes.OpenId); scopes.Add

Return 404 status code in aspnet core SPA Angular application

ε祈祈猫儿з 提交于 2020-01-02 07:17:25
问题 I am working on a project using the Angular SPA project template for dotnet core (the one available in VS2017 and dotnet core 2.0). I have an Angular component to display a "Not Found" message if a user goes to an invalid URL. I also have server-side pre-rendering enabled. When returning the prerendered "Not Found" page from the server, how would I make it return an HTTP status code of 404? Every method I have found to do this uses Express as the backend webserver, I have not been able to

ASP.NET Core 2.1 Angular 6.0 SPA template - razor page (cshtml) for index instead static page

纵然是瞬间 提交于 2019-12-17 16:26:40
问题 I am trying to migrate my ASP.NET Core 2.0 Angular 5 application with webpack setup to ASP.NET Core 2.1 Angular 6 with Angular-Cli . Short question: How can I force parsing razor pages directives from cshtml with Microsoft.AspNetCore.SpaServices.Extensions ? I do not want to use index.html from Angular.json , but index.cshtml . Long description: I started a new ASP.NET Core project from Angular template. There are quite a few things that just magically works. There is an index.html file

Angular 6 with ASP.NET Core, internal CMD not working properly

偶尔善良 提交于 2019-12-11 02:08:10
问题 Hello I have Angular 6 project with ASP.NET Core 2.0. backend. Working in Visual Studio. No server side rendering, just SPA. When i run my project (F5), ng serve command automatically called by .Net, code below. Produces new command line window, but it seems like the styles (line rewriting, text progress bars,...) not working. app.UseSpa(spa => { spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { spa.UseAngularCliServer(npmScript: "start"); } }); Text stops rendering, but

IdentityServer4 authenticate each client separately

≯℡__Kan透↙ 提交于 2019-12-06 06:17:28
I use two different clients. The IdentityServer4 provides API protections and log in form. Can I configure clients to avoid single sign on. I mean that even if I logged in the first client I need to log in the second client too. My ID4 configuration: internal static IEnumerable<Client> GetClients(IEnumerable<RegisteredClient> clients) { return clients.Select(x => { var scopes = x.AllowedScopes.ToList(); scopes.Add(IdentityServerConstants.StandardScopes.OpenId); scopes.Add(IdentityServerConstants.StandardScopes.Profile); scopes.Add(IdentityServerConstants.StandardScopes.OfflineAccess); var

Return 404 status code in aspnet core SPA Angular application

£可爱£侵袭症+ 提交于 2019-12-05 23:58:34
I am working on a project using the Angular SPA project template for dotnet core (the one available in VS2017 and dotnet core 2.0). I have an Angular component to display a "Not Found" message if a user goes to an invalid URL. I also have server-side pre-rendering enabled. When returning the prerendered "Not Found" page from the server, how would I make it return an HTTP status code of 404? Every method I have found to do this uses Express as the backend webserver, I have not been able to find any resources for doing this on an aspnet core backend. Thanks for any help! Edit for clarity: I am

How to configure ASP.net Core server routing for multiple SPAs hosted with SpaServices

时光毁灭记忆、已成空白 提交于 2019-11-27 11:48:33
I have an Angular 5 application that I want to host with Angular Universal on ASP.net Core using the latest Angular template RC . I've followed the docs and have the application up and running. The problem is that I am also using Angular's i18n tools , which produce multiple compiled applications, 1 per locale. I need to be able to host each from https://myhost.com/{locale}/ . I know that I can spin up an instance of the ASP.net Core app for each locale, and set up hosting in the webserver to have the appropriate paths route to the associated app, but this seems excessive to me. Routes are