- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Nizamuddin Siddiqui has Published 2307 Articles
Nizamuddin Siddiqui
473 Views
The Accept header tells the server in what file format the browser wants the data. These file formats are more commonly called as MIME-types. MIME stands for Multipurpose Internet Mail Extensions.Versioning can be send in Headers like below.Version=1 StudentsV1Controller Version=2 StudentsV2ControllerSince we have not handled the version in accept headers, ... Read More
Nizamuddin Siddiqui
381 Views
An exception filter is executed when a controller method throws any unhandled exception that is not an HttpResponseException exception. The HttpResponseException type is a special case, because it is designed specifically for returning an HTTP response.Exception filters implement the System.Web.Http.Filters.IExceptionFilter interface. The simplest way to write an exception filter is ... Read More
Nizamuddin Siddiqui
316 Views
The DefaultHttpControllerSelector class in web api is responsible for selecting the appropriate controller action method that we send in the URI.Say we have to implement versioning in the query string like belowv=1 StudentsV1Controller (Version 1) v=2 StudentsV2Controller (Version 2)If we pass the versioning information in the query string like http://localhost:58174/api/student?v=1 ... Read More
Nizamuddin Siddiqui
611 Views
Once a Web API service is made public, different client applications start using our Web API services. As the business grows and requirements change, we may have to change the services as well, but the changes to the services should be done in way that does not break any existing ... Read More
Nizamuddin Siddiqui
2K+ Views
The HTTP verbs comprise a major portion of our “uniform interface” constraint and provide us the action counterpart to the noun-based resource. The primary or mostcommonly-used HTTP verbs (or methods, as they are properly called) are POST, GET, PUT, PATCH, and DELETE. These correspond to create, read, update, and delete ... Read More
Nizamuddin Siddiqui
2K+ Views
A public method in a controller is called an Action method. Let us consider an example where DemoController class is derived from ApiController and includes multiple action methods whose names match with HTTP verbs like Get, Post, Put and Delete.Examplepublic class DemoController : ApiController{ public IHttpActionResult Get(){ ... Read More
Nizamuddin Siddiqui
10K+ Views
Filters are used to inject extra logic at the different levels of WebApi Framework request processing. Filters provide a way for cross-cutting concerns (logging, authorization, and caching). Filters can be applied to an action method or controller in a declarative or programmatic way. Below are the types of filters in ... Read More
Nizamuddin Siddiqui
6K+ Views
Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin ... Read More
Nizamuddin Siddiqui
1K+ Views
We can create our own custom class as a result type by implementing IHttpActionResult interface. IHttpActionResult contains a single method, ExecuteAsync, which asynchronously creates an HttpResponseMessage instance.public interface IHttpActionResult { Task ExecuteAsync(CancellationToken cancellationToken); }If a controller action returns an IHttpActionResult, Web API calls the ExecuteAsync method to create an ... Read More
Nizamuddin Siddiqui
7K+ Views
The Web API action method can have following return types.VoidPrimitive Type/Complex TypeHttpResponseMessageIHttpActionResultVoid −It's not necessary that all action methods must return something. It can have void return type.Exampleusing DemoWebApplication.Models using System.Web.Http; namespace DemoWebApplication.Controllers{ public class DemoController : ApiController{ public void Get([FromBody] Student student){ ... Read More