Thoughts on .Net & Coding

.Net Articles, tutorials, reviews, code and more...

  • 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.

  • 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.

  • Highlight Keywords From Response Using ASP.NET Core Middleware

    Recently I needed to search for certain keywords from the response body and then highlight them with different color. In ASP.NET Web Forms you would have created an HTTP module to achieve this. In ASP.NET MVC you would have written a custom filter to accomplish this task. In ASP.NET Core you can write a custom middleware to do the same. The remainder of this article shows how.

  • Prepare ASP.NET MVC / ASP.NET Core Projects to use Angular 2 in 10 Easy Steps

    Now that Angular 2 is finally available, it would be good to try your hands on this new framework. If you are an absolute beginner in Angular 2 you may find preparing your ASP.NET projects a bit confusing. That's because you need to take quite a few steps before you actually start your Angular 2 development. Angular 2 documentation already have two great articles available here and here that guide you to the whole process. In this article I am going to discuss how you can prepare your ASP.NET MVC and ASP.NET Core projects to use Angular 2. I expect that you are already familiar with ASP.NET MVC / ASP.NET Core. Although you are not expected to have Angular 2 experience, a basic idea about what it does would be helpful. This article won't go into too much of the syntax level detailing. My aim here is to show you how and ASP.NET MVC and ASP.NET Core projects can be prepared to use this new framework.