can any one explain the difference between the mvc and web application in asp.net. in mvc we can find controllers folder. cant we able to find controllers folder in web application..! please vanish my confusion.
-
possible duplicate of [What are the key differences between ASP.NET webforms and MVC](http://stackoverflow.com/questions/142132/what-are-the-key-differences-between-asp-net-webforms-and-mvc) – nawfal May 04 '14 at 16:45
2 Answers
MVC uses controllers to orchestrate the models and views to provide user interfaces to the user.
Web forms doesn't use controllers to achieve this, it uses code behind with events.
MVC is built around the notion of separation of concerns - each thing is responsible for its own bit, and shouldn't be concerned with what other bits are doing. Webforms has them a bit more mushed together, where code sits associated 1:1 with the webform (in the code behind), often leading to business logic creeping into the UI.
WebForms uses a powerful eventing system to help abstract away some of the complexities of HTTP, such as its stateless nature. MVC doesn't do this, which requires the developer to work within the confines of a pure HTTP environment. The eventing system in WebForms lets you quickly wire up events in a familiar way if you've come from a VB6/WinForms background (which the target audience had when ASP.NET was first released).
Have a look at http://www.asp.net/mvc which has a lot of great tutorials on getting started with MVC.

- 19,961
- 7
- 57
- 90
-
thankyou. but which one is efficient while using asp.net application with database, MVC or webforms. – Mihir Jan 31 '11 at 04:17
-
1@Mihir - it depends (sorry). WebForms may be slightly more efficient because of its out of the box databinding controls such as the grid, pagers etc. MVC might be better because of its testability (arguably easier than in webforms). But they each have their uses and are suited to different tasks. Database efficiency in terms of query execution etc is much of a muchness since they both use the same libraries to communicate with the DB. – Michael Shimmins Jan 31 '11 at 04:20
An ASP.NET MVC application is an application which depends upon the ASP.NET MVC Framework. MVC stands for Model, View Controller, the three components which define an application created using the MVC pattern.
The MVC pattern aims to seperate an applications logic, data and presentation into distinct, somewhat independent components.
Model
Models are a representation of an application's data. For example a shopping application might have a Cart model to represent the state of a user's shopping cart.
View
A view is a visual representation of the data contained in the model. A view class should knoow the specifics of how the model(s) it uses should be presented.
Controller
The Controller's job is to handle user input and update the state of the Model to reflect the changes that were made as a result of user action. For example imagine the user is viewing a Contact Us page and clicks the Submit button. The controller would respond to the button click by updating the model with values from the form fields and then save the model, causing it to be validated and then written to the database.
This is a very shallow and incomplete explaination of the MVC pattern you should head over to the ASP.NET MVC homepage to get a more complete view of the MVC pattern and the ASP.NET MVC framework.
An ASP.NET Web Application uses a separate framework known as Web Forms. Because Web Forms does not use the conventions defined in the MVC pattern, the Web Application template does not create a similar folder structure .
The use of either framework is not mutually exclusive, the two represent differing approaches to the same problem. With respect to which is most efficient for data access I would refere you to Michael Shimmins' excellent comment

- 3,982
- 1
- 31
- 50