ASP.NET Core Web API custom formatters

Use accept headers to return new formats like CSV from an ASP.NET Core Rest service

postman csv

ASP.NET Core does support out of the box JSON, XML, or plain text formatters based on the ACCEPT Header. In this post, I’ll explain how to specify other formatters and return them based on the ACCEPT Header. As an example, I use a CSV formatter to return a CSV formatter. A controller method returns the format based on the ACCEPT Header which is specified by the client. This can be very useful in cases where you need to export your data to Excel, and the use of more formats makes your application more accessible.

Continue reading “ASP.NET Core Web API custom formatters”

Advertisement

Remove locks from Azure resources

Remove locks from azure resources to be able to change or delete them

In my previous blog post Lock Azure resources to prevent accidental deletion, I showed how to add a lock to a resource with an ARM template to protect it from accidental deletion. When you want to delete the resource, you first need to remove the lock. A lock cannot be removed with an ARM template. To remove the lock you can use:

  • Powershell
  • Rest API
  • Portal

Continue reading “Remove locks from Azure resources”