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.

Order

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

Advertisement

Concurrency vs Multi-threading vs Asynchronous Programming : Explained

Recently, I was speaking in an event and I asked a question about Asynchronous programming to the audience, I found that many were confused between multi-threading and asynchronous programming and for few, it was same. So, I thought of explaining these terms including an additional term Concurrency. Here, there are two completely different concepts involved, First – Synchronous and Asynchronous programming model and second – Single threaded and multi-threaded environments. Each programming model (Synchronous and Asynchronous) can run in single threaded and multi-threaded environment. Let’s discuss each in detail.

Synchronous Programming model – In this programming model, A thread is assigned to one task and starts working on it. Once the task completes then it is available for the next task. In this model, it cannot leave the executing task in mid to take up another task. Let’s discuss how this model works in single and multi-threaded environments.

Single Threaded – If we have couple of tasks to be worked on and the current system provides just a single thread, then tasks are assigned to the thread one by one. It can be pictorially depicted as

singlethreadedHere we can see that we have a thread (Thread 1 ) and four tasks to be completed. Thread starts workingon the tasks 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

Presented on ASP.NET performance tuning in C# Corner Hyd Chapter Event : 12th July 15

11753645_10153514597568086_9069014579518330181_nHello All,

This was the first when I presented at a community event in Hyderabad. I was pretty excited for the day as I started hearing about this city since my college days due to its significance in IT. And yeah Microsoft’s develop center is also in this city. The day arrived and when I reached the venue, I found that most of the seats were full very early and we had some time to start the event as per schedule. Many kept standing throughout the event as the seats were already occupied completely. Here one point to be noted that we organized this event after long in this city and managed to get a venue which was not very known, also not easily accessible. I wasted more than an hour even when somebody was guiding me for the place on phone. Continue reading

Your Dependency Injection ready ASP.NET : ASP.NET 5


Dependency Injection has become one the key design patterns of the current projects. It helps in writing loosely coupled code which makes the code easily testable and maintainable. As per wiki

Dependency injection is a software design pattern that implements inversion of control for software libraries. Caller delegates to an external framework the control flow of discovering and importing a service or software module specified or “injected” by the caller.

In this post, we will see that how easily we can implement this pattern with ASP.NET 5 projects and leverage various available options .

ASP.NET 5 got completely redesigned and made DI friendly. It provides a by default container which can be used while writing the application. It also enables us to use third party containers with it and you may need a adapter to use with ASP.NET. Continue reading

Recap – Presented on ASP.NET 5 at #GIDS Banglore – Download Slides and demo

IMG_9518 - Copy

Great Indian Developer Summit (GIDS) is Asia’s largest technology event where thousand of developers joins each year. The event took place at IISc Bangalore during 21-24 April 2014 where many veteran speakers presented on various topics.

This year, I gave an one hour Talk on one of my favorite topics – ASP.NET 5. ASP.NET is always very near and dear to me and it got more awesome because of the kind of changes is taking place in coming version. People were very enthusiastic about the talk and the Hall got full ten minutes before the schedule and some of them were event standing at the back. Although it was a completely demo oriented session where I wrote the code live on Visual Studio 2015 but I presented few slides to give the audience bigger picture.

I talked on the core changes of ASP.NET 5 and discussed Middle-ware, Dependency Injection, Configuration management etc. Please find my slides below. Continue reading

Getting started with Tag Helpers – ASP.NET 5

ASP.NET has been always near and dear to me and it got more exciting for me as ASP.NET5 got revolutionary changes comparing to previous versions. All the changes has been done considering key points that are driving the software evolution like Agility, embracing latest design standards and technologies. It provides more capabilities, more power to developer, follows latest standards and helps in writing Cloud and mobile ready applications. As we know ASP.NET is like a umbrella of technologies and consists of ASP.NET MVC, ASP.NET WebForms, ASP.NET web api etc. All these technologies got lots of change and design to serves the modern web apps. ASP.NET5 comes with another new version of ASP.NET MVC6. I will be writing couple of posts on cool features of ASP.NET 5 that actually makes our life easy as a developer. Continue reading

Reboot NCR (31st Jan) – A very successful event

Hello All,

In this post, I am going to write the summary of Reboot event that we conducted with the support of Microsoft Gurgaon. It was a full day event and 5 speakers kept the 100+ audience engaged in their sessions throughout the day. I took the second session of the day and talked about the features offered by ASP.NET 5.  Everybody enjoyed the session and amazed with the features that Microsoft bringing with ASP.NET5.

Slides of my session are attached with this post. Just to note that I have used Visual Studio 2015 Beta1 release for the session and as it is not a final release there could be some difference in final release but the concept would be same.

Some of the pics of my session..

IMG_30891975098_10155119890895463_5459032723523304022_n

 

 

 

10957327_10155119889000463_2552868464931909734_n1924536_10155119905620463_5541168978162528134_n

 

 

 

 

 

 

 

 

For more snaps, please click here

Slides of my session are

Hope you all enjoyed the day with fun way of learning. Do let me know if you have any specific feedback.

Cheers,
Brij

The installer was interrupted before application could be installed. You need to restart the installer to try again

In this post, I am going to share one error that I faced couple of times earlier and its resolution.

Issue –

You have created a installer using Web Setup project with VS 2010. Using this you used to install the application on IIS7.5. Now you got a new machine with IIS7.5 installed (or you installed manually). Now after making the required changes, when you are installing with the MSI, you are getting the following error.

msierrorNow as per the message, you restart the installer but you get the same message again.

As, you don’t get the enough information here so you check the Event Viewer but you don’t find any error there. When you carefully see then you find two info entries there with the messages

1- <Application Name> — Installation failed

2- Windows Installer installed the product. Product Name <Application name and details>. Manufacturer Name – <manufacturer name>. Installation success or error status 1603.

From all the above information, there is no indication about the actual cause of the error. From the above error code if you search on Internet, you will find different resolutions but not the one discussed here. At least I didn’t the below resolution for the above problem.

Note – The above message or code that we found looks like common for many other errors so there could be different resolutions based on scenario.

Solution

One of the possible reasons that it is not getting installed because IIS6 management compatibility is not configured on IIS. So let’s see the steps to configure it.

1) Go to Control Panel -> Program and features -> Turn Windows Features on or off

2) Click on Internet Information Services and it should look like

IIS6Compatibility-No3) If IIS6 management compatibility is not checked then it could be a issue. Please select it as

IIS6Compatibility-Yes4) And click Apply/Ok.

Once the above steps completes. You should be able to install the installer on your machine.

Cause

Now let me briefly discuss that What is IIS6 management compatibility and why the issue surfaced in the above case?

IIS7+ is completely overhauled and there are many breaking changes in it. IIS7 introduced two modes Classic and Integrated mode. Integrated mode combines the modules of IIS and ASP.NET when application runs in Integrated Mode. All the metadata moved to different file in IIS7. So If an application uses the features of IIS6 then it should configure the IIS6 management compatibility in IIS7.

Now the question arises that why do we need this?

Visual studio 2010 installer still targets the older version of IIS (means IIS6) although IIS7 was publicly available in 2008. That’s why IIS6 compatibility is required.

Hope this post will help you.

Thanks,
Brij

 

IIS7 and Higher : system.webServer element ApplicationHost.config vs Web.config

Hi All,

This is another post on Authentication for ASP.NET applications. In one of my last posts, I talked about setting up authentication mode as Windows in web.config and Enabling/Disabling windows authentication at IIS. You can access that post from the below link.

Looking into Windows authentication at Web.config and at IIS
Continue reading