ASP.NET Overview And Comparison Of ASP.NET Technologies

ASP.NET is a Microsoft Web Development Framework. It is a part of the .NET Platform. ASP.NET is used to build single page applications, dynamic applications, enterprise applications, and online banking applications etc.

Let’s discuss the different models of ASP.NET Framework.

  • NET Web Pages
  • Net Web Forms
  • NET MVC

Yes, these are the three different models of .NET Framework. Now, you might be thinking about ASP.Net Core, and so you should know that it is the modal of .NET Core Framework.

Don’t Confuse  Framework, Modals, Libraries 

Remember that

  • .NET itself is a Platform which has many frameworks inside
    • Net (Web Framework)
      • Net Web Pages (Modal)
      • Net Web Form (Modal)
      • Net MVC (Modal)

    • .Net Core (New Platform)
      • Net Core (Web Framework)
        • Net Web Pages (Framework)
        • Net MVC (Modal)

.NET Core is actually using MVC 6.

Comparison of ASP.Net Technologies

We have three different frameworks in ASP.Net

  • Web Pages
  • Web Forms
  • MVC

ASP.NET

According to Microsoft, if we use any framework then the output will be the same. But there is a reason behind this separation. Every Framework has its own pros and cons (advantages and disadvantages)

Let’s discuss these frameworks.

Web Pages

w3school is the most known website to learn any web-based technology. It is built on the top of web pages frameworks of ASP.NET. In Web Pages, client-side code and server-side code are placed at the same page. It is similar to PHP, and now it is called classic (old) ASP. If you want to build an application which is something dynamic or partially dynamic, then you may prefer web pages.

Web pages are preferred to build information based sites and blog-type applications. The applications you see on the internet with (.asp) extension is built on the top of Web Pages framework.

Web Forms

Now, let’s discuss the history of Windows before digging into web forms. In 1980’s, mostly DOS based OS was used which is like cmd in our Windows.

DOS

We used commands there to create, read, update, delete the files. But then Microsoft launched Windows in which everything was graphical so that we can do everything through GUI. As Microsoft was successful in GUI, it repeated something visual once again to become successful in the programming world. As we know already, we want button or grid we need to code for them to look like a button or grid. But Microsoft launched Visual Studio in which every programming language is replaced with the Visual programming language.

Like if you were working in C++ then you can use Visual C++ in which controls are already present like buttons, menus and you need to just drag and drop the controls and code the functionality behind it.

Microsoft does the same thing in Web Forms to separate the client side and server side. History again repeats and Microsoft becomes very famous among developers eventually due to this feature. Now, we can design the client side on client side layer and we can code behind it. It was much better than the classical Web Pages approach. Now the development becomes so much fast, we performing event-based application development. And it is what we say RAD (Rapid Application Development) fast development.

Web Forms File Based

A web form is actually the file based like Payoneer is built on the top ASP.Net Web Form framework. When we open any Web Form page in the browser page, the web form extension is (.aspx) and at the backend, the complete file (.aspx.cs) is in execution. So, whenever we hit on any page of Web forms then the complete file will comes into execution (.aspx + .aspx.cs). So we say that it is file based.

Each technology has its own pros and cons. It was not better for the Enterprise level application. Let’s discuss the problems with Web Forms.

  • The web is actually action based. We request to the server and then the response comes back. But Web Forms are actually following View First Architecture. We trigger an event on view first then the complete life cycle of the page include Page_Load executes and then the action executes. Now if we trigger another event once again on the same page, then again the complete life cycle of the page will execute and then the actual method executes. What is the Hell going on?
  • Web Forms doesn’t support Reusability. Don’t know how much effort is required to make the web form application reusable. Like,

There are 2 pages which is something same in Web forms, then we need to code behind each control, again and again, whether we have 2 pages or 2+. There are actually no layers in web forms. If we want to make reuse the code then we need to understand the concept of layers and make the layered architecture.

  • Another problem, suppose we are working on Web Form Application, at a time 2 different developers can’t work on the client side (.aspx) and server side (.aspx.cs). Only 1 developer can perform its duty at 1 side at a time. At least there should be different layer then they can perform programming at a time.

    ASP.NET

We can see there are 3 files of 1 page.

  • (.aspx) is for the front end
  • (.aspx.cs) for the backend
  • (.aspx.designer.cs) is used to initialize the ready-made objects which we use in Web forms by drag and drop from the toolbox. We don’t write a single line of code here, Visual Studio automatically generates and initialize the objects here.
Unit Testing

It is so much difficult to test the code in Web Forms because there are lots of functions who executes behind one event. It is quite difficult to find out where the problem is in the code. But in MVC, we can add the separate project for the unit testing purpose. And can perform clean unit testing without any changes in the actual application code.

MVC

MVC resolves all the above issues.

  • MVC actually the masterpiece of layered approach architecture. It is by default layered. 2 or more developers can work on different layers at the same time.
  • MVC is action based.
  • The request directly comes to actual action and there are no extra lifecycle actions.
  • We can add a unit testing project to resolve the testing issue.
  • It has dynamic response type. We need to set the return type of action just as ActionResult, now we are open to returning anything either it is a file, json, view anything.

Remember there are 2 terms MVC and ASP.Net MVC. MVC itself is a design pattern. ASP.Net MVC is a library. ASP.Net itself is a framework.

  • M (Model): Business Layer    (Data)
  • V (View): Presentation Layer (Generates the Output UI)
  • C (Controller) : Handles User Input (Logic)

As it is layered, so they are decoupled. We can replace 1 layer with any other different technique. All this is the layered architecture is actually the beauty of SOC (Separation of Concerns) in which each logic is a different place with respect to its concerns. SOC describes each layer is responsible for itself.

Services

Web Services is actually the hot favorite topic these days. You might be hearing about Web Services, WCF Services, and Web APIs. The purpose of Web Service is to take the request from the client and push it to the server and then comes back with a response from the client. With the help of Web services, we request from different devices and the request goes to the Web Server and data comes back. Web API is also an example of Web Service but Web service is just a general term, and Web API is something special in Web Services.

  • Web Services and WCF Services are totally SOAP-Based.
  • They use HTTP Protocol.
  • All the clients can’t handle this SOAP-based communication because SOAP is completely XML based. So handling SOAP messages means handling XML which might be tedious and complicated tasks for clients.
  • Web API is actually REST based. It means that
    • We use 4 different types of request here in Web APIs.
      • GET, POST, PUT, DELETE
    • Every Resource/Functionality has a URI
    • Not always be XML, it can be JSON.

SignalR

SignalR is used for Real-Time Communication like communication in facebook, skype. This is the framework for Real-Time Communication purposes.


Similar Articles