asp.net-core

Visual studio 2017 / 2019 add areas missing

佐手、 提交于 2021-02-18 05:01:05
问题 While creating a ASP.NET MVC Core Web app using VS2017 / 2019, came across that 'Add Areas' option is missing from Context menu. 回答1: Area is not removed from VS 2017/19 but it is moved in Scaffolding and you can access the area using below steps: 1) Right click on your project and click on Add>New Scaffolded Item 2) After click choose the MVC area from the Menu: 3) After choosing give it Name, and after this the Area will be added to your project: Hope it will helps. 回答2: I had a same

Visual studio 2017 / 2019 add areas missing

寵の児 提交于 2021-02-18 05:01:01
问题 While creating a ASP.NET MVC Core Web app using VS2017 / 2019, came across that 'Add Areas' option is missing from Context menu. 回答1: Area is not removed from VS 2017/19 but it is moved in Scaffolding and you can access the area using below steps: 1) Right click on your project and click on Add>New Scaffolded Item 2) After click choose the MVC area from the Menu: 3) After choosing give it Name, and after this the Area will be added to your project: Hope it will helps. 回答2: I had a same

EF Core - adding/updating entity and adding/updating/removing child entities in one request

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-17 21:00:18
问题 I am struggling with what seemed to be a couple of basic operations. Let's say I've got a class named Master: public class Master { public Master() { Children = new List<Child>(); } public int Id { get; set; } public string SomeProperty { get; set; } [ForeignKey("SuperMasterId")] public SuperMaster SuperMaster { get; set; } public int SuperMasterId { get; set; } public ICollection<Child> Children { get; set; } } public class Child { public int Id { get; set; } public string SomeDescription {

How to resolve .NET Core package version conflicts

自作多情 提交于 2021-02-17 18:55:06
问题 I am migrating from a .NET MVC 5 Web Application to a .NET Core 2.2 Web API project along with five .NET Standard 2.0 projects all housed under one solution. I am now receiving 28 warnings (MSB3277) regarding package conflicts, which are all within the System namespace. For example, there appears to be a version conflict for System.Collections.Concurrent between Version=4.0.11.0 and Version=4.0.14.0 (see error block below). Troubleshooting attempted: I tried uninstalling all of the .NET Core

Is there a way to add claims in an ASP.NET Core middleware after Authentication?

谁都会走 提交于 2021-02-17 15:15:32
问题 I have this in my startup: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSwaggerWithUi(); app.UseAuthentication(); app.UseMiddleware<SomeMiddleware>(); app.UseMvc(); } I need to add some additional claims AFTER the user is authenticated, but the middleware Invoke function always fires before Auth (HttpContext.User.Identity

Is there a way to add claims in an ASP.NET Core middleware after Authentication?

痴心易碎 提交于 2021-02-17 15:14:53
问题 I have this in my startup: public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSwaggerWithUi(); app.UseAuthentication(); app.UseMiddleware<SomeMiddleware>(); app.UseMvc(); } I need to add some additional claims AFTER the user is authenticated, but the middleware Invoke function always fires before Auth (HttpContext.User.Identity

Logging from ASP.NET 5 application hosted as Azure Web App

感情迁移 提交于 2021-02-17 15:14:18
问题 I have an ASP.NET 5 Web API that I host in Azure as a Web App. I want to log messages from my code using Azure Diagnostics. There are multiple article including Azure docs that suggest that it should be as easy as System.Diagnostics.Trace.WriteLine once enabled. The logs should show up under LogsFiles/Application and in log stream in Azure. I enabled application logging for the web app: But the following calls produces no logs: System.Diagnostics.Trace.TraceError("TEST"); System.Diagnostics

Use SSL Certificate in ASP.NET Core 2.1 while Developing

霸气de小男生 提交于 2021-02-17 14:54:16
问题 On an ASP.NET Core 2.1 I application appSettings file I have the following: "Kestrel": { "Certificates": { "Default": { "Path": "localhost.pfx", "Password": "1234" } } } I created the certificate using the dotnet command: dotnet dev-certs https -ep "localhost.pfx" -p 1234 And I copied the localhost.pfx file to the project root along the appSettings file. When I run the project on http://localhost:5000 it is redirected to https://localhost:5001. However, I receive the browser error saying the

ASP.Net Core makes too many cookies for my app to handle

时光总嘲笑我的痴心妄想 提交于 2021-02-17 05:50:06
问题 I have a test application that I am using to test integration with my WSO2 Identity Server IDP. When run by itself it works just fine. It makes an .AspNetCore.Antiforgery cookie and an .AspNetCore.Cookies cookie. The anti-forgery cookie is 190 bytes and the main cookie is 3.7K bytes. But if I login to another application first, then load my my test harness page, it get 4 additional cookies: .AspNetCore.CookiesC1 - 4K Bytes .AspNetCore.CookiesC2 - 4K Bytes .AspNetCore.CookiesC3 - 4K Bytes

ASP.Net Core makes too many cookies for my app to handle

倖福魔咒の 提交于 2021-02-17 05:50:01
问题 I have a test application that I am using to test integration with my WSO2 Identity Server IDP. When run by itself it works just fine. It makes an .AspNetCore.Antiforgery cookie and an .AspNetCore.Cookies cookie. The anti-forgery cookie is 190 bytes and the main cookie is 3.7K bytes. But if I login to another application first, then load my my test harness page, it get 4 additional cookies: .AspNetCore.CookiesC1 - 4K Bytes .AspNetCore.CookiesC2 - 4K Bytes .AspNetCore.CookiesC3 - 4K Bytes