Relative Content

Tag Archive for c#asp.net-core-webapi

How to access Route parameter in Custom validator in ASP.Net core Web API?

I have implemented custom model validator using dataanotations, where I wanted to compare two dates and validate if one is greater than other or not. It works fine in POST(create) endpoint.
However the problem is in PUT(update) endpoint.
Because in PUT method, we want to get one date from database using the {id} which is in PUT endpoint.

Multiple Authentication In Net Core

I’m developing a native application consuming a rest api. Currently my rest api protected by JWT bearer. I want to limit a client using my rest ip. The idea is to add the client certificate to every client. Like we want to certify the client app at the same time authenticate the user using this client.
However i can’t merge both CertificateAuthenticationDefaults and JwtBearerDefaults. My [Authorize] attribute on my controller only able to accept either CertificateAuthenticationDefaults or JwtBearerDefaults not both scheme at the same time. Any reference to solve this?

FormData binding into ASP.NET Core Web API

I am working on an application where I am supposed to get a formData response that contains the below properties. The thing is I am unable to get a property and the JSON property is not working for me.