Skip to main content

Three Tier architecture Web Application Development in asp.net

3-Tier Web Application Development

In web application development, three-tier architecture refers to separating the application process into three specific layers. What the user sees via a web browser is called the presentation tier and is content served from a web server. The middle tier performs the business logic processing that occurs, for example, when a user submits a form. The back end consists of the data tier which handles the database processing and access to the data. We'll take a simplistic look at each of these. 

Previous  post explained about  What is JSON (JavaScript Object Notation) ,  What is sharding - Databases .


Presentation Tier

The Presentation Tier or User Interface is the portion the user sees when they open a web page in the browser. It is as simple as you reading this article all the way to searching a catalog and purchasing a product using a shopping cart. It is what is presented to the user on the client side within their web browser.

If you were to view the source code, you would only see code such as HTML, Javascript, and Cascading Style Sheets. On some sites, you may see Java Applets and Flash. Viewing source code on a web page, you would NOT see database queries or loops or calls to classes or any behind-the-scenes processing.

In ASP.net and utilizing Visual Studio or Visual Web Developer, developers can separate the user interface from the business logic and data access layer with various tools.

ASP.net allows using MasterPages to setup the site look and feel. As well, when creating a WebForm which utilizes the MasterPage, you may create it and allow the code to be placed in a separate file, known as codebehind, thus keeping your business logic in a separate layer from the look and feel.

You may also setup the site design using Themes, Skins, and Cascading Style Sheets.

Languages used in this layer are typically HTML, DHTML, CSS and javascript.

Business Logic or Application Tier

The Business Logic, Functional Process Logic, Business Rules (all pertaining to the same thing), are kept in a separate layer. In ASP.net, this is where you define your classes and source code. This can be in the App_Code folder for your classes and methods. Web languages typically used in ASP.net are VB and C#. You would not use HTML or Javascript in this layer. In this layer you typically define your classes, functions, sub procedures, properties, etc.

Data Access Tier

In ASP.net, the Data Access layer is where you define your typed datasets and tableadapters. It is where you define your queries or stored procedures. The business tier may then make use of this functionality. In your classes, rather than defining ad hoc queries, you may use a TableAdapter to access the Data Access Layer.

An Example

As an example of how this works, let's assume you are creating a web page that allows the user to enter information which you wish to then enter into a database. You first create a dataset and tableadapter that allows insert into the table, either by a query or stored procedure. This is your data access layer.

You then create a class, which retrieves the information from the form, checks for field validations and then uses the tableadapter to send the data to the database.

You create a web form, which can use a GridView control or other controls to allow the user to input the data into the web form. In the codebehind of the web form, you handle the submit button click event, and send the data from the form to your class, which sends the information to the database using the tableadapter.

Benefits

When utilized properly, using a multi-tier architecture improves performance and scalability. If a web page needs an update or redesign, all of this may be handled by altering the CSS and HTML, without affecting the business or data logic. Any of the three tiers may be replaced or upgraded individually without affecting the other tiers. For instance, if you change the database on the back end, it wouldn't affect the presentation or business logic tiers, other than changing the database connection.

This is a simple introduction to the three-tier web architecture, but I hope it has helped you understand the layers of a multi-tier architecture.

May your dreams be in ASP.net!  ramakrishna.pathuri 

Three Tier Web Application Development in asp.net Examples in asp.net 

http://www.codeproject.com/Articles/11128/3-tier-architecture-in-C

http://www.codeproject.com/Tips/662107/Understand-3-Tier-Architecture-in-Csharp

http://www.aspdotnet-suresh.com/2010/05/introduction-to-3-tier-architecture-in_17.html

Comments

Popular posts from this blog

Asp.Net AjaxFileUpload Control With Drag Drop And Progress Bar

This Example explains how to use AjaxFileUpload Control With Drag Drop And Progress Bar Functionality In Asp.Net 2.0 3.5 4.0 C# And VB.NET. Previous Post  I was Explained about the   jQuery - Allow Alphanumeric (Alphabets & Numbers) Characters in Textbox using JavaScript  ,  Fileupload show selected file in label when file selected  ,  Check for file size with JavaScript before uploading  . May 2012 release of AjaxControlToolkit includes a new AjaxFileUpload Control  which supports Multiple File Upload, Progress Bar and Drag And Drop functionality. These new features are supported by Google Chrome version 16+, Firefox 8+ , Safari 5+ and Internet explorer 10 + , IE9 or earlier does not support this feature. To start with it, download and put latest AjaxControlToolkit.dll in Bin folder of application, Place ToolkitScriptManager  and AjaxFileUpload on the page. HTML SOURCE < asp:ToolkitScriptManager I...

View online files using the Google Docs Viewer

Use Google Docs Viewer for Document viewing within Browser I was looking for a way to let users see Microsoft Word Doc or PDF files online while using my application without leaving their browser without downloading files and then opening it to view with Word or PDF viewer . I was looking for some way out either via any PHP or Microsoft.NET libraries, did some googling on that; but later on I just got an idea that google already has all code written for me.. when I have any email attachment in PDF or DOC or DOCX google does it for me ..! Even while searching I can see PDFs by converting them in HTML. So I just googled it up and found that Google already has this ability that we can use Google Docs Viewer without any Google Account Login . YES that's true no Google Account login is required. It's damn simple and easy. Just pass document path as attachment as parameter and we are done. Google Docs Viewer gives us ability to embed PDF, DOC/DOCX, PPT, TIFF:...

How to send mail asynchronously in asp.net with MailMessage

With Microsoft.NET Framework 2.0 everything is asynchronous and we can send mail also asynchronously. This features is very useful when you send lots of bulk mails like offers , Discounts , Greetings . You don’t have to wait for response from mail server and you can do other task . By using     SmtpClient . SendAsync Method (MailMessage, Object)    you need to do  System.Net.Mail has also added asynchronous support for sending email. To send asynchronously, you need need to Wire up a SendCompleted event Create the SendCompleted event Call SmtpClient.SendAsync smtpClient.send() will initiate the sending on the main/ui  thread and would block.  smtpClient.SendAsync() will pick a thread from the .NET Thread Pool and execute the method on that thread. So your main UI will not hang or block . Let's create a simple example to send mail. For sending mail asynchronously you need to create a event handler that will notify that mail success...