What is 3-Tier Architecture and how is it implemented in ASP.NET?

Can anybody please make me clear regarding this doubt..?

Recommended Answers

All 12 Replies

3-tier refers to separating your code by task. So, you might have all your HTML/CSS/JavaScript (client code) in .aspx pages, then implement all your business logic in ASP.NET "code behind" pages, and all your database i/o as stored procedures in SQL Server.

Thanx for the reply.

I read that a 3-tier architecture consists of a webserver, appserver and a database server.I heard that in Java environment Webserver and is Weblogic/ Websphere/Tomcat etc. Appserver is Tuxedo and Business logic is in EJB? I know that in .net IIS or BizTalk is webserver. What appserver is used in .Net and what exactly is business logic in generic sense?

Mutyala Rao Aripaka

The webserver is IIS, the database server would be SQL Server, and the application server layer is also IIS, though specifically it's an ISAPI DLL which interacts with IIS. Think of it as the "ASP.NET" server.

When I say "business logic", I'm referring to the implementation of the specific goals or reasons behind the application. Why are you writing the application? What is it supposed to do? It's rarely just "gather information from a user and store it in a database". In other words, HOW you gather information, via a specific form, a series of forms, a "wizard", a file upload, etc. isn't a business rule. That's interface design, and it's very important, but it isn't dictated by business logic.

You store that information in a database. The business logic doesn't dictate whether to use inline dynamic queries or stored procedures, or inform you how to layout your tables (usually).

A business rule might be "check to see if the person is already a customer, and if so, show them their purchase history".

When a think 3-tier, I don't think in terms of servers, I think in terms of functionality: all code to write, read, update, and "maintain" the database, goes either in the database, via stored procedures, or a database "class" in my application. All interface work is in external JavaScript and CSS files, with only the bare mininum done via ASP.NET "server objects" and their properties. Business logic is done in ASP.NET code-behind files.

Thanx for the message. Now i have got an idea about 3tier architecture. Then what can be in n-tier architecture?

Most of the time, n-tier actualy refers to 3-tier. The concept can be extended, though, to describe any system that uses code or server-separation to achieve a process.

I regularly work on projects that require several steps, and those steps are often divided betwee discrete programs and/or servers. One could call that "multi-tier" or "n-tier". For example, a customer presents me with a database. They want that data to generate a personalized print mailing campaign.

These are some of the steps:

1) data conversion (their data may not be organized "properly")

2) address extraction, conversion, sorting

3) PostScript and/or PDF generation
3a) image manipulation
3b) copyfitting
3c) page device commands
3d) postal barcoding

4) Archival

5) Printing

There also may be web-based components, for reporting or order generation. As a software engineering project, each of those steps might be called a "tier", and handled as a separate sub-project. That would be an "n-tier" development project.

Well, must say that the .net people generally don't know what a true 3'tier system is, the java world is more mature to handle that.

A true 3 tier solution is seen as:

3 tiers that are physical separated (not logical) from each other.
Each tier must know as little as possible about the other ties.
Theoretical, it should be possible to remove 1 tier without change the others.

So what is each tier then?

First tier, is the frontend. In a .Net world that means IIS and ASP.net (including the “code behind as mentioned before). The “code behind is frontend code hence it manipulates the data, received from the middle tier, to present it as HTML or do validation before sending the data to the middle tier.

Middle tier, is where the business logic is placed. This will typical be where any transactions is started and ended, by manipulation the data from the third tier, mostly called the resource/data layer. This tier have no idea of the total solution is a web application, webservice or different kind of application.

Tired tier (also call data/resource layer) could be a database, message queue, interfaces to external webservice and so on.

In theory each layer know nothing about the others layers, other than call them to send or receive data that fulfill their task. Each layer should talk through a pattern/interface so each layer is in depended of each other.
(I know theory and practice not always is the same, but you should always think this ways)

When all this is said, small web application often merges the first 2 (first tier and middle tier) tires, which actually is ok / under one circumstance: They must be logical separated through a pattern/interface so they later can be separated with rewriting the whole stuff. This is where 99% fails in their architure and they have to hire expensive consultants like me ;)

Rule number one:
Even if you start with a poc. (proof of concept).

9 out of 10 solutions is started as a poc, and still is even when they are out in production.

Fill free to comment..


Hi IT Senior,

Thanks for ur reply. That was an out and out thoeretical explanation which is very informative and unveils the underlying concept.

ITSenior great response. Below is my thought to possibly provide additional insight.

Java vs. .NET is a common topic. What the Java folks have over the .NET folks is strong experience in OO design patterns where majority of ASP .NET developers have come from VB and ASP where OO was not possible.

If you are curious about design patterns I urge you checkout O'Rielly's "Head First Design Patterns" book, http://www.oreilly.com/catalog/hfdesignpat. This is a must read for all of our new employees as architecture is the sole key for an application, web or windows, to succeed.

3-tier simpy refers to an application which segregates its presentation, business, and data into layers.

Presentation is your ASP .NET pages and controls

Business layer is a little more complicated as it can span application and machine domains. For a web developer our responsibility would be to ensure all business specific functionality and objects are split out into classes and assemblies. If needed we are also responible for providing communication to middleware software such as BizTalk, webMethods, SAP XI, ect.

Data is your databases; Oracle, DB2, SQL Server, MySql, ect.


In ASP.Net perspective 3 tier architecture is to seperate the business logic from the presentation logic. 3 tier architecture consists of

1.Presentation Tier
2.Business Logic Tier
3.Data Access Tier

Basically, ASP.Net itself is designed in 3 tier architecture called Modal-View-Controller also known as MVC architecture.
In ASP.Net the presentation is devided from the business using the code behind files.

View - .aspx file (Front End/GUI)
Modal - Class Library (Business Logic)
Controller - .cs code behind file (Methods defined in page
which gets activated by application user action)

Please look into the attached file

Hi Frndz,

Can you tell me how web server (IIS) and application server (asp.net server) are connected ? just one word - For instance connection between application server and database server is through oledb or odbc .

Thank u
Nams here...

Thank You very much. Actually I implemented the application in this way; but I was not sure, whether this is the right way or not. Now it is confirmed.
Thanks a lot!

I'm glad you got it helpful.
Please do not resurrect old threads. If you have any questions please ask. You are welcome to start your own threads.

Thread Closed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.