Skip to main content

Difference between WebForm and MVC in Asp.Net

Asp.net framework is a small part of .Net framework for building and running web applications. We can design and develop a web application or website using either Asp.Net MVC for Web Forms. In this article we will see some important difference between Asp.Net Web Forms and Asp.Net MVC.

Difference between WebForm and MVC in Asp.Net

Asp.Net Web Form Asp.Net Web MVC
Asp.Net Web Form is not an Open Source. Asp.Net Web MVC is an Open Source.
In Asp.Net you will have a server controls like TextBox, Buttons etc. In Asp.Net MVC you will have html helpers.
For client side state management Asp.Net Web Forms supports view state In Asp.Net MVC view state is not supported.
Asp.Net Web Form follows Web Forms Syntax Asp.Net MVC follow customizable syntax (by default it’a a Razor)
Asp.Net Web Form has file-based URLs that means file name exist in the URLs must have its physically file existence. Asp.Net MVC has route-based URLs means URLs are divided into controllers and actions and it is based on controller and actions, physical file is not required here.
In Asp.Net Web Form, ASPX pages are tightly coupled to Code behind(.CS). In Asp.Net MVC, design (Views) and logic(Controller) are resides separately.
In Asp.Net, for consistent look and feels we can use Master Pages. In Asp.Net, for consistent look and feels we can use Layout views.
In Asp.Net, for code re-usability we can use User controls. In Asp.Net, for code re-usability we can use Partial Views.
Asp.Net Web Form follow a traditional event driven development model. Asp.Net MVC follow MVC (Model, View, Controller) pattern based development model.
Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access like repeater, grid etc. Asp.Net MVC provides full control over html markup and support many features that allow fast and agile development. Asp.Net MVC is is best for developing interactive web application with latest web standards.

I hope it will help you to identified the basic difference between Asp.Net Web Forms and Asp.Net MVC.

Difference between HTTP GET and HTTP POST method

HTTP GET request append all the required data to the URL while in HTTP POST method it will supply all the additional data to the body of message.
Each form element in HTML form must have an method attributes, it can use either POST or GET. Get is a default method for form element if we are not specifying it. specified method attribute determines how form data is submitted to the server. GET method will encode all the data and append to the request URL as a query string. Post method will pass all the data in a message body of the HTTP request.

Lets see all the difference 1 by 1 for GET and POST method as below.

HTTP GET HTTP POST
In Browser history all the params are stored in the URL. In Browser history none of the params are stored
Get method can be cached Post method can not be cached
Get method restrict form data type, it allows only ASCII chars Post method not restrict form data type, it allowed even binary data
Get method is easier to hack using script Post method is more difficult to hack
GET request is executed again on click of back button Post request alerts user for resubmitting data to the server
In get request all the data being passed are visible to user, It is visible in the address bar. In Post method none of the data is visible to the user because it is being passed in message body
Get method is not advisable to use when we are sending sensitive information to the server like password Post method is advisable to send sensitive information to the server. However it’s better we encrypt the sensitive data using complex algorithm
Get request can be bookmarked in the browser Post method can not be bookmarked to the browser.
Get is less secure as compare to Post method Post is little more secure to get method
Get method save data to the server as a plain text and in browser history Post method not save data to the server and browser history
Get method pass data in a URL and URL length is restricted up to 2048 char, we can not send more data and allowed length, It varies by browser and web server. In Post method there is no restriction on passing very long data.
Get method can support very limited data to the request, it is better if we pass less then 2K of parameters. Post method can send more parameters like we can also send uploading files to the server.

That’s it.

I hope you enjoy this article.