Category "asp.net-core"

ASP.NET Core MVC app can't find error page?

I have an ASP.NET Core 3.1 MVC applications (not a Razor Pages project) and I'm trying to use the exception handling middleware via app.UseExceptionHandle("/err

How to fill attribute value from database on Razor Pages .netCore

I have an attribute above the action Method, the value of which must be filled from the database But I do not know how to do this I want to use this attribute i

ServiceFilter and TypeFilter - what is the difference in injection those filters?

ServiceFilter we must register in Startup.cs. TypeFilter is injected by Microsoft.Extensions.DependencyInjection.ObjectFactory, we don't need to register that f

Why app returns only one supported culture?

I try create language switch on my site. I've add cultures in Startup: IList<CultureInfo> supportedCultures = new List<CultureInfo> { new Cultur

Dot Net Core - How to Prevent appsettings.production.json from changing upon publish

I'm publishing my .net core website to the server. Here is the code that adds Json files to my content path: var builder = new ConfigurationBuilder()

ASP .NET Core 6 with Windows authentification - don't show user login prompt dialog

I've created an ASP .NET Core 6 Web App with Windows authentification from a template and I assume that current Windows user's credentials to be obtained autom

How to make "One or more validation errors occurred" raise an exception?

I'm running a WebAPI on Core 3.1 and one of my endpoints excepts JSON with a model that has fields with [Required] attribute like so: public class Vendor {

Microsoft.Extensions.Logging custom implementation, how to get the caller method name?

I'm in .NET 6, I implemented a custom ILogger<TService> (of Microsoft.Extensions.Logging). Usually, when I implement a logger, I also get the caller metho

Lazy loading in EFCore loads all the data even if not accessed

I have been trying to use lazy loading in ASP.NET core 6, I have followed the documentation to do so. However, the behavior of the lazy loading is not the same

stdout message shows "Access to the path 'C:\Windows\system32\config\systemprofile' is denied" as log

I have hosted .net core application on IIS. When i am trying to browse the application, HTTP Error 502.5 - Process Failure error comes up on browser. On checkin

Post FromBody Always Null

I've got a new API that I'm building with ASP.NET Core, and I can't get any data POST'ed to an endpoint. Here's what the endpoint looks like: [HttpPost] [Ro

Create WSDL for an ASP.Net Core ApiController

I am creating a service using ASP.Net Core. The service is based on the ApiController. [ApiController] public class XmlALaCarteServiceController : ControllerBa

Combine Json and file upload in a controller

I'm trying to send a form with Angular to a controller that contains json and a file. [HttpPost("Save", Name = "SaveReportRequest")] public ActionResult<Repo

Serialize Enum as DisplayName or EnumMember Value

I have an enum declared in c#. I have a Display Name/ EnumMember value annotation and Student Class. I'm using asp.net core 2.2+ version with Odata. [DataContra

How to customize all response in .Net Core?

Im using .Net Core to write a json api server, so I need customize all response to like: public class Result { public int Code { get; set; } public stri

How to set the base path or the ApplicationPath for ASP.NET MVC application

I have an ASP.NET MVC web application which I want to put behind NGINX reverse proxy. Currently the web application is served from the domain's root, i.e., http

Setting connection string with username and password in ASP.Core MVC

I am working on my first ASP.NET Core MVC application.What is the right way to specify the connection string in a ASP.NET Core MVC application with a sql server

Can ASP.NET CORE MVC be hosted in Xamarin App(Android)?

I have a ASP.NET CORE MVC (.NET CORE 3.1) application running well on Kestrel in Windows, Now I'm wondering if possible to migrate it to Android via Xamarin? T

IFormFile always return null in asp.net core 2.1

Here's how I upload file my Api action : [HttpPost] public async Task<BaseListResponse<MediaStorageModel>> MediaBrand(IFormFile file, int brandId)

"Error unprotecting the session cookie" exception

i have an Asp.NET MVC application with this Authentication setup: ConfigureServices(): services.AddSession() services.AddAuthentication(sharedOptions => sh