asp.net-core

ASP.NET Core JWT/Windows Authentication HTTP 400 Error

落花浮王杯 提交于 2021-02-18 18:52:09
问题 I have an ASP.NET Core 2.1 Web API which currently requires users to enter a username/password to recieve a JWT for authorization. I want to add the option of using Windows Authentication to recieve a JWT as well. Ultimately, I plan to have two authorization controllers, one for username/password, the other for Windows Auth. To test this, I first enabled Windows Authentication in IIS express, by right clicking on my project and going to Properties. Then, I made a simple test controller to see

IdentityServer4 implementation with React SPA and Asp.net Core backend

旧巷老猫 提交于 2021-02-18 18:01:43
问题 We have asp.net core (v3.0) Web API backend(no auth yet). A frontend is going to be a SPA( React ). A frontend basically will be an admin panel, it means the website's home page should be just the login page. We are planning on using IdentityServer4 for auth(separate project). If we create the IdentityServer4 project( MVC ) it will have its own login form/page. Since opening our client website(react) login form should be opened, popout and iframe is not the way we are considering to use, what

Blazor Mono Clientside Error after updating to netcore3.0-preview8

霸气de小男生 提交于 2021-02-18 14:14:10
问题 I have updated my blazor client side project project from preview7 to preview 8, runnign with Visual Studio 2019. I have followed the instructions detailed here; ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 8 However, when I build the solution get the following error; Fatal error in IL Linker 5> 5>Unhandled Exception: Mono.Linker.Steps.XmlResolutionException: Failed to process XML description: ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft

Blazor Mono Clientside Error after updating to netcore3.0-preview8

最后都变了- 提交于 2021-02-18 14:13:22
问题 I have updated my blazor client side project project from preview7 to preview 8, runnign with Visual Studio 2019. I have followed the instructions detailed here; ASP.NET Core and Blazor updates in .NET Core 3.0 Preview 8 However, when I build the solution get the following error; Fatal error in IL Linker 5> 5>Unhandled Exception: Mono.Linker.Steps.XmlResolutionException: Failed to process XML description: ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft

Validation Form With Ajax in Asp.net Core

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 13:06:42
问题 I use AJAX to send forms to controller in ASP.NET Core but I have problem with send form with validation <form asp-action="Create" asp-controller="Departments" data-ajax="true" data-ajax-method="Post" data-ajax-mode="replace" data-ajax-update="#content" data-ajax-success="Success" data-ajax-failure="Failure"> <div class="box-body"> <div class="alert alert-success" id="divalert" ></div> <div class="form-group"> <label asp-for="Title" class="control-label"></label> <input asp-for="Title" class=

Validation Form With Ajax in Asp.net Core

守給你的承諾、 提交于 2021-02-18 13:04:05
问题 I use AJAX to send forms to controller in ASP.NET Core but I have problem with send form with validation <form asp-action="Create" asp-controller="Departments" data-ajax="true" data-ajax-method="Post" data-ajax-mode="replace" data-ajax-update="#content" data-ajax-success="Success" data-ajax-failure="Failure"> <div class="box-body"> <div class="alert alert-success" id="divalert" ></div> <div class="form-group"> <label asp-for="Title" class="control-label"></label> <input asp-for="Title" class=

How do I set a default home page in ASP.NET Core 2?

倖福魔咒の 提交于 2021-02-18 12:44:31
问题 I am having some difficulty configuring a default home page in an ASP.NET MVC Core 2 application. I seem to be unable to get the routing to map to the correct home page a the default when no parameters are used, ex. https://localhost:44362 I don't really like the default convention of putting Controllers in a Controllers folder, view in Views, and View Models in Models. I prefer to group by feature. So I have a structure like this: Features Home HomeController.cs HomeIndex.cshtml

Sorting using property name as string

倖福魔咒の 提交于 2021-02-18 12:25:08
问题 I would like my Web API to be able to sort its output by a string parameter such as this one: http://myapi.com/api/people?skip=0&take=50&orderBy=lastName&descending=true . Because I also have pagination support (with skip and take ) in my API, I would like the orderBy and descending parameter to be applied to the SQL query directly, so that the correct result comes from the database. When doing this however, the code can become very hard to manage when trying to match the parameters for

Multi-host deployment of ASP.NET Core applications

北城以北 提交于 2021-02-18 12:20:12
问题 I am quite confused as I haven't seen any blogs or instructions on how to host ASP.NET Core/.NET Core applications with HA and multi-host deployments. All examples are either: 1) One NGINX reverse-proxy, one Kestrel 2) One IIS reverse-proxy, one Kestrel And both components on same host. In real-life production environments, you have LB maybe service discovery, multiple frontends, multiple backends, etc. But for this case there are no instructions whatsoever. So my questions would be for multi

RequestSizeLimitAttribute: HTTP 500 instead of 413 in ASP.NET Core 2.1.401

你说的曾经没有我的故事 提交于 2021-02-18 12:10:49
问题 I have [RequestSizeLimit] on my API controller, and it kinda works as expected: requests bigger than specified limit are rejected. [HttpPut] [RequestSizeLimit(120_000_000)] public async Task<IActionResult> Put(IFormCollection form) { ... } The problem is, an exception is thrown: Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Request body too large. at Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException.Throw(RequestRejectionReason reason) at Microsoft