ASP.NET Core 2.0 disable automatic challenge

As pointed out by some of the other answers, there is no longer a setting to turn off automatic challenge with cookie authentication. The solution is to override OnRedirectToLogin: services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => { options.Events.OnRedirectToLogin = context => { context.Response.Headers[“Location”] = context.RedirectUri; context.Response.StatusCode = 401; return Task.CompletedTask; }; }); This may change in the future:

Disable transitive project reference in .NET Standard 2

Transitive project references (ProjectReference) Transitive project references are new feature of SDK-style csproj (1,2) format used in .NET Core/.NET >= 5. You can also use this csproj for old .NET Framework projects (1,2,3) but with some exceptions. In this SDK-style format project references (represented by <ProjectReference> entry in .csproj file) are transitive. This is different … Read more

The specified CGI application encountered an error and the server terminated the process

I was able to solve this issue by removing forwardWindowsAuthToken from the web.config file under wwwroot. Navigate to src/ProjectName/wwwroot Open the web.config In the httpPlatformremove the forwardWindowsAuthToken=”true/false” property Redeploy and mine worked fine. See here for plenty of discussion

Using EF Core ThenInclude() on Junction tables

but I get an ICollection in the last lambda displayed, so I obviously need the Select() No, you don’t. EF Core Include / ThenInclude totally replace the need of Select / SelectMany used in EF6. Both they have separate overloads for collection and reference type navigation properties. If you use the overload with collection, ThenInclude … Read more

Change the JSON serialization settings of a single ASP.NET Core controller

ASP.NET Core 3.0+ You can achieve this with a combination of an Action Filter and an Output Formatter. Things look a little different for 3.0+, where the default JSON-formatters for 3.0+ are based on System.Text.Json. At the time of writing, these don’t have built-in support for a snake-case naming strategy. However, if you’re using Json.NET … Read more

Uploading and Downloading large files in ASP.NET Core 3.1?

If you have files that large, never use byte[] or MemoryStream in your code. Only operate on streams if you download/upload files. You have a couple of options: If you control both client and server, consider using something like tus. There are both client- and server-implementations for .NET. This would probably the easiest and most … Read more

How to use Newtonsoft.Json as default in Core Web Api?

In .NET Core 3.0+ include the NuGet package Microsoft.AspNetCore.Mvc.NewtonsoftJson and then replace services.AddControllers(); in ConfigureServices with services.AddControllers().AddNewtonsoftJson(); This is a pre-release NuGet package in .NET Core 3.0 but a full release package in .NET Core 3.1. I came across this myself, but I’ve found that the same answer with some additional info is in this … Read more