12 tips to increase the performance of ASP.NET application drastically – Part 2

This post is second part of my previous post where we discussed six tips to improve the performance of ASP.NET applications. In this post, we are going to discuss six more tips that could be another round a booster for your application performance. The link of previous post is below.

12 tips to increase the performance of ASP.NET application drastically – Part 1

  1.   Make your page asynchronous

IIS uses CLR thread pool to get a thread that processes a request that comes to the application. Say, if there are currently twenty threads available in pool, it means only twenty request can be served in parallel and if request processing takes some time then it could turn into disaster if hundred odd request are bombarded in few milliseconds. In this case…Read complete post on Infragistics blog

Routing not working when upgrading Angular library to 1.4 : Solution

I wrote a lot about AngularJS (18 articles till date) but recently I was working on a project where we upgraded the AngularJS library from 1.0 to 1.4 and found that many functionalities stopped working. Routing was one major part and one of my team member rushed me for a solution and then I realized the amount of changes.

One of the major changes, Routing is not part of the main Angular library and it needs to be added as external module. And we need to inject ngRoute if we want to use it. This changes took place in v1.2. In this post, I am considering that we are upgrading from 1.0.* to 1.4.* . I am taking example of one of my previous posts and upgrade that here. Both old and updated solution is attached. Let’s have a look again on the example screen

Continue reading

Asynchronous programming with async and await : explained

In one of my previous posts, I discussed about the synchronous and asynchronous programming model. We saw in details that how does it work in single and multi-threaded mode. This post is extension of that post and here we are going to discuss the two relatively new keyword async and await and how does that actually work. I got many questions around this so sharing it in details here. If you are not very clear about how synchronous and asynchronous programming works and how does it work in single and multi-threaded scenario then refer my previous post mentioned below.

Concurrency vs Multi-threading vs Asynchronous Programming : Explained

Continue reading

12 tips to increase the performance of ASP.NET application drastically – Part 1

Building web application and hosting it on a web server is insanely easy with ASP.NET and IIS. But there are lots of opportunities and hidden configurations which can be tweaked that can make it high performance web application. In this series post, we are going to discuss some of the most unused or ignored tricks which can be easily applied to any web application.

  1. Kernel mode cache – It is one of the primary tools widely used for writing making web application faster. But most of the times, we don’t use it optimally and just leave some major benefits. As each asp.net request goes through various stages, we can implement caching at various level as belowcachingoppWe can see that request is first received by http.sys so if it is cached at kernel level, then we can save most of the time spent on server as http.sys is a http listener which sits in OS kernel…Read complete post on Infragistics blog

Master Page, User Control, Custom Control and Content page : Order of page life cycle event

As we all know that while serving an asp.net request goes through many stages before it gets served. One of the important stages is, going through the page life cycle events. As a page can contain many other controls like User Control, Custom control etc and it can be a combination of master and content pages as well. As each control has its own life cycle so if they are inter weaved then it becomes very important to understand that how each event fits in complete lifecycle . Also this is one of the most asked question in asp.net interviews so I thought of explaining it.

Technically, Master page is nothing but a normal user control so you can treat it as user control used on a page and we will consider it same in our post. So we can say that there are two type of controls – User Control and Custom Control in a page. Content page is also nothing but a normal aspx page. Now to understand the order of events where all of these controls are available, lets first understand of the life cycle of each components individually.


Note- I have not included all the events of life cycle only those are relevant at important to explain the topic. Continue reading

Concurrency vs Multi-threading vs Asynchronous Programming : Explained

Recently, I was speaking in an event and I asked a question to the audience in between my talk about Asynchronous programming , I found that some of the people were confused between multi-threading and asynchronous programming and some were saying that both are same. So I thought of explaining these terms and add one more term Concurrency. Here there are two concepts involved and both are completely different, First – Synchronous and  Asynchronous programming and second – Single threaded and multi-threaded applications. Each programming model (Synchronous and Asynchronous ) can run in single threaded and multi-threaded environment. Let’s discuss these in detail.

Synchronous Programming model – In this programming model, when a thread assigned to one task and start executing. Then completes the executing task then able to take up another task. In this model, it can not leave the executing task in between to take up some another task. Lte’s discuss how this model works in single and multi-threaded scenario.

Single Threaded – If we have couple of tasks to be worked on and the current system provides a single thread which can work all those, then it takes one by one and process as

singlethreadedHere we can see that we have a thread (Thread 1 ) and four tasks to be completed. Thread starts processing one by one and completes all. (The order in which tasks will be taken up, does not affect the execution, we can have different algorithm which can define the priorities of tasks)

Continue reading

How to test email functionality without configuring Smtp Client

Writing code for sending mail is one of the common tasks that we need to work every now and again. Sometimes it is one of the requirements in our application and some time we develop to send alerts to all when application looses its control on production :).

.NET made it very simple to send the mail which normally looks a complicated task. We can easily write 4-5 lines of the code to send the mail. Lets just have a look on a sample code

Continue reading