Global Exception Handling in ASP.NET Core WEB API

In my previous post, i have used multiple ways (Exception filter, Global.asax, OnException at Controller etc.,) to implement exception handling in Asp.Net MVC. Asp.Net Core comes with many in-built and ready to use middleware, and you can add them to your application in the Startup class Configure method. One of the in-bulit ASP.NET Core diagnostic… Read More »

Explicitly implementation of Interface

In this post, We will learn how to implement multiple interfaces with same method name with example. When a class which has inherited an interface explicitly implements methods of that class is called explicit implementation.This method can now be accessed only through interface instance.They are useful in cases when a class inherits two interfaces and both… Read More »

Error: Unable to connect to the Database. A network-related or instance-specific error occurred while establishing a connection to SQL Server.

Error: Unable to connect to the Database. Description: While trying or establishing a database connection and the connectivity to the database is not configured properly then this error occurs. More exception details as followed. Exception Message: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or… Read More »

Difference between Local & Global Temporary Tables

In this post, we will learn what is temporary tables, types of temporary tables and difference between local & global temporary tables. Temporary Tables are a great feature that lets you store and process intermediate results by using the same selection, update, and join capabilities that you can use with typical SQL Server tables. The… Read More »

What’s new in Angular 4

AngularJS is one of the most popular JavaScript frameworks to create dynamic Web apps. It is maintained by Google. In this article, I will explain what the new changes that come with Angular 4.0 are. Why not Angular 3? Due to misalignment of router package version . As @angular/router was using v3.3 already , so… Read More »

Accordion in AngularJS

Accordions are useful when you want to toggle between hiding and showing large amount of content as below image: Follow the below steps to show accordion in page using angularjs as above image. Step 1:  First create a module which define the angular application and add controller with some dummy data to show in accordion… Read More »

Autocomplete in AngularJS

In this post, we will learn how to autocomplete on a textbox in angularjs with example. Autocomplete provides suggestions while you type into the field. For example a user types the letter ‘I‘ in textbox of country, autocomplete displays matches suggestions like India, Iraq, Indonesia etc. Example: Step 1: First create a module which define the angular… Read More »

Failed to serialize the response in Web API

Simplest example of this, I get a collection and try to output it via Web API: // GET api/items public IEnumerable<Item> Get() { return MyContext.Items.ToList(); } And I am  getting the below error while hitting the api via Postman: This is a pretty common error to do with the new proxies, and I know that… Read More »

IHttpActionResult vs HttpResponseMessage

In this post, we will learn the difference between IHttpActionResult and HttpResponseMessage, advantages of using the IHttpActionResult, why should we use IHttpActionResult instead of HttpResponseMessage and predefined helper methods for IHttpActionResult with examples. In web Api 1, We have a type called HttpResponseMessage for returning Http response message from action method. It is easy to use… Read More »

How to change the Action name in ASP.Net MVC

ActionName attribute can be used for changing the action name. Below is the sample code snippet to demonstrate more : [ActionName(“TestActionNew”)] public ActionResult Test() { return View(); } So in the above code snippet “Test” is the original action name and in “ActionName” attribute, name – “TestActionNew” is given. So the caller of this action… Read More »