"Knowledge has to be improved, challenged, and increased constantly, or it vanishes."

K. G. Sreeju Nair

Knowledge has to be improved, challenged, and increased constantly, or it vanishes.

  • Running background tasks in ASP.Net applications

    While developing applications, you may come across various occasions where you create background services to achieve automation in your applications. Such services include sending notification, update a user’s subscription expiration or may be changing the state of a workflow activity and so on.

    Developers use Windows Service, Cron jobs or Executables that works in a separate thread than your web applications that works based on a schedule. In .Net, for creating a background task, developers mainly use the Console Application or Windows Service template. While this will do the job, it adds some complexity. Few of the issues developers face with background services are below

    • You may use configuration files in the web application such as connection string, logs file path etc, however for the console application, you need to redefine them under its application settings, something your operation team will not prefer, of course this adds operations complexity.
    • Migrating the application may lead to troubles as I have seen several times, the migration happens without migrating the background service and then developers troubleshoot and identifies they forgot some of the services.
    • Modifying the code in the application and database structure may impact the background service.
    • And many more


    Though it had limitations, developers used it a lot especially when they need to implement background services. Now with the ASP.Net framework has built in capability to run background tasks from the web application itself. Cool, for many of you, it must be music to your ears, now from the same project you can manage your pages, application logic and background services.

    Background Service in Asp.Net application

    In ASP.Net background tasks can be implemented as hosted services. In this article, I am going to demonstrate how you can develop a background service in ASP.Net

    For the purpose of this demo, I used the following environment.

      • ASP.Net 6
      • Visual Studio 2022 Preview
      • ASP.Net Web application


    Also, I have a class in my application called Task that has a due date and Is Completed flag. I have a page that create a task by setting a due date. Now I am going to create a background service in ASP.Net application itself that set IsCompleted to true for tasks when it reaches the due date.

    See the Task class below.

    public class Task { public int Id { get; set; } public string Title { get; set; } public DateTime DueDate { get; set; } public bool IsCompleted { get; set; } public DateTime ActionDate { get; set; } }

  • Python programming using Visual Studio Code

    For years I have been using Visual Studio for developing .Net applications. While Visual Studio is a great IDE is for enterprise application development, Microsoft released Visual Studio Code that is simpler and mostly general-purpose editor. Visual Studio Code is awesome, lightweight, cross-platform and you can extend it with plug-ins. Recently I have been asked by a friend of mine to suggest him an editor for him to learn Python, and I thought of suggesting him Visual Studio Code. I prepared a video tutorial that explains how to setup Visual Studio Code to create, edit, debug and run Python applications.


  • Geolocation in ASP.Net Core using Azure Maps

    With the advancement in technologies, the world has become a global village. The people all over the world are interconnected. It is quite common that the companies publish their contents in multiple languages. With trade laws differ from country to country the developers need to make their website address the users who visit their web application by identifying the user’s country.

  • Integrate Amazon SNS with Asp.Net Core Application

    Amazon SNS is a notification service that offer message delivery. SNS basically supports messaging between a variety of publishers and consumers. Publishers shall send notifications to Topics and Subscribers can consume the messages. Amazon SNS supports Application to Application messaging and Application to Person messaging.

    In this article I am going to demonstrate the Application to Person subscription in Amazon SNS. In Application to Person messaging, SNS supports the following.

    • SMS Messaging
    • Mobile Push Notifications
    • Email Notifications


  • Index is not an attribute class – Error while migrating from ASP.Net MVC 5 to .Net Core

    Recently one of my friends was migrating a project from ASP.Net MVC 5 to ASP.Net core 3.1. One of the challenges he faced is with the Index Attribute in data annotations. The .Net Core is not recognizing the Index attribute. When he copied his class from his MVC 5 project, he got the following error message.

  • Sending Push Notifications from ASP.Net Core using Google Firebase

    Recently I was engaged in a project where by the customer wanted to push messages to the mobile application from their website. For e.g. when a page is published in the website, a new product added or price changed for a product, customer wanted to send push notifications to the mobile applications in these events.

  • The String Interpolation ($) Special Character

    While developing applications, it is quite common that you are required to produce formatted output. This is a common scenario for any developer whether you develop console application, web application or Mobile application. With C# 6 onwards Microsoft introduced a special character called interpolation operator ($) to help developers easily manipulate the string literals.

    In this article, I am briefly explaining the interpolation operator with the help of couple of examples.

    Let us consider the example of adding two numbers and print their sum as the output. Very simple example. The below is the old (ugly) way of doing this in C# with ASP.Net.

    int a = 2, b = 3, sum = a + b;

    Response.Write("The sum of " + a + " and " + b + " is " + sum);