Thoughts on .Net & Coding
.Net Articles, tutorials, reviews, code and more...
-
Create Custom Exception Filter in ASP.NET Core
In my previous article I explained how errors in an ASP.NET Core web application can be dealt with using middleware. I also mentioned that time that you can also use exception filters to handle errors. In this article I will explain how to do just that. In ASP.NET MVC 5 you used the [HandleError] attribute and OnException() controller method to deal with exceptions that arise in the actions of a controller. In ASP.NET Core the process is bit different but the overall concept is still the same.
-
Five Methods to Deal with Errors in ASP.NET Core
Error handling is a common practice in any real-world web application. In ASP.NET Web Forms you used certain events and custom error pages to deal with them. In ASP.NET MVC you used [HandleError] attribute, exception filters and custom error pages to deal with them. In ASP.NET Core you have a set of methods and, of course, exception filters at your disposal. In this article I will discuss five methods that are used in connection with error handling.
-
SemVer for Absolute Beginners
As a software developer you are probably aware of versioning and its importance. Probably somewhere you came across this term - SemVer - and wondered what exactly it is or how does it relates to versioning in general. To that end this post briefly describes what SemVer is. SemVer is a short form for Semantic Versioning. SemVer is a specification that describes how software version numbers are to be given.
-
ASP.NET Core - Old Solution Structure Vs. New Solution Structure
Recently one of the reader, who was quite new to ASP.NET Core, asked this question - "I am following your instructions to create a working example based on your article. After creating the project my solution explorer looks different than your screen shots. Why is so? Am I missing something?" In this short post I am explaining why you see two different solution structures in Visual Studio 2015.
-
Convert JSON and XML markup into C# classes using Visual Studio
Visual Studio provides a plethora of features that make you more productive. One such feature is converting XML or JSON markup into C# classes. This article discusses this feature with a few examples. XML and JSON are the two commonly used data formats for serializing data over the wire. Many a times you need to map XML or JSON markup to C# classes. No doubt, you can create these C# classes manually but Visual Studio can provided a good starting point by automating the process.
-
Programmatic Model Binding Using UpdateModel()
ASP.NET MVC offers model binding to capture form field values entered in a view. In many cases model binding to complex types serves the purpose. When the model type to fill from the values is known at development time, you can specify a parameter of that type. However, this is not always the case. That is where programmatic model binding comes handy. Programmatic model binding allows you to perform model binding at runtime based on some condition or processing logic.
-
Consume ASP.NET Core Web API using HttpClient
In the previous article you learnt to consume a Web API created in ASP.NET Core using jQuery client. Although local clients are quite common in Ajax rich applications, many real-world situations require that you call a Web API from a different application. Thus the client application and the Web API application are different and you can't use JavaScript to call the Web API (due to default browser settings). Moreover, if you wish to call a Web API from a desktop application JavaScript is not an option. In such cases you can use HttpClient to call the Web API. This article tells you how.
-
ASP.NET MVC - Online course scheduled in January - February 2017
The next batch of our online course in ASP.NET MVC is scheduled in January - February 2017. Topics covered include ASP.NET MVC / Core, Entity Framework, Web API, Identity, Ajax using jQuery, Ajax using AngularJS and more.
-
Consume ASP.NET Core Web API using jQuery
In the previous article you learnt to create a Web API using ASP.NET Core. A Web API can be consumed by local clients or remote clients. Local clients are the clients that are housed in the same web application as the Web API. Remote clients are the clients that are not part of the Web API application. As far as web applications are concerned a typical local client takes a form of jQuery (or JavaScript) Ajax driven user interface that consumes the Web API.
-
Create Web API in ASP.NET Core
Creating Web API in ASP.NET Core is similar to creating Web API in ASP.NET MVC with a few differences. In this article you will learn to build a simple REST style Web API that performs CRUD operations on the Customers table of the Northwind database.