ASP.NET Core – Four basic ways to receive parameters

There are four basic ways to receive parameters in an ASP.NET Core Web API: query strings, path parameters, request body, and request headers. I’ll show examples of these below. Query string parameters Let’s say you have two query string keys: name and servings. To get these query string values, add method parameters with names that … Read more

ASP.NET Core – How to get request headers

There are two ways to get request headers: When a request comes in, the framework loads request headers into the Request.Headers dictionary. You can use this just like any other dictionary. Here’s an example of using TryGetValue() to check if a request header exists and get its value: Note: To just check if a header … Read more

Postman – Follow redirects with the original HTTP method

When you send a request with Postman and get a 301/302 redirect response, it follows the redirect with a forced GET. This means it sends a GET request to the redirect URL and doesn’t include the original HTTP method or Content-Type. This can result in two unexpected errors: Here’s what this looks like in Postman … Read more