How to disable verification for specific controller in ASP.NET Core - asp.net-core

There is controller with methods. Request validation must be disable for one of method. I try use attribute [ValidateInput(false)], but visual studio cannot find it. I use .net core 2.1.

There is no request validation in ASP.NET Core.

Related

Disable session per controller in ASP.Net Core 3.x

Is it possible, in ASP.NET Core 3.x to disable session related middleware per controller or method, either via Attribute or some other mechanism?
In fact, is there a generic strategy for disabling any middleware on these levels?
Thanks in advance.

What is the alternate of HttpRequest.EnableRewind() in ASP.NET Core 3.0?

BufferingHelper.EnableRewind();
Above is an extension method for HttpRequest object in ASP.NET Core 2.2. It is no more there in ASP.NET Core 3.0 (atleast with this name). I want to know it's alternate in ASP.NET Core 3.0. I am not sure if
HttpRequestRewindExtensions.EnableBuffering();
is the alternate.
The alternate is HttpRequestRewindExtensions.EnableBuffering(), indeed. You can see here that internally it just calls EnableRewind().

Is it possible to use an existing ASP.NET Core AuthenticationHandler with ServiceStack?

I have a custom AuthenticationHandler built to tie into the Claims-based authorization in ASP.NET Core. Is it possible for ServiceStack to re-use this component, or will I have to implement it as a custom AuthProvider?
Have a look at the new mvcidentity .NET Core template which shows an example of using ASP.NET identity Auth to protect both MVC and ServiceStack Services.
The integration is enabled with the new NetCoreIdentityAuthProvider which provides a bidirectional adapter that converts between an ASP.NET Core ClaimsPrincipal and a ServiceStack User Session.

WebTelemetryInitializerBase in ASP.NET Core / MVC6

Is there an MVC6 compatible version of WebTelemetryInitializerBase that would work with ASP.NET Core (on the full .NET Framework)?
See my question here where I asked how to get HttpContext in my temeletry initializers. Unfortunately I didn't specify that I was using MVC 6 and thus no System.Web.HttpContext.
Yes, there is a version of this for aspnetcore. Check out the Microsoft Application Insights for ASP.NET Core applications repo.
There is an implementation of getting the WebUser found in /src/Microsoft.ApplicationInsights.AspNetCore/TelemetryInitializers/WebUserTelemetryInitializer.cs which you can use as a guide.
The TelemetryInitializerBase class is the one that consumes the IHttpContextAccessor which is used to get the HttpContext.
From there you can get the Microsoft.AspNetCore.Http.HttpContext.User which is they type of System.Security.Claims.ClaimsPrincipal

Controller life-cycle ASP.NET Core WebApi

I'm using asp.net core to develop a WebApi.
What is the life-cycle of controller in ASP.NET Core? Does it depends on the web server?
Usually an instance of a controller is created per request and if you use dependency injection, all associated services are created for that request.