Initial thoughts on ASP.NET MVC versus Web Forms

We recently switched our project from VB.NET WebForms to C# MVC 5. I couldn’t be happier with the results.

Not having to deal with the page life-cycle and viewstate has been a dream. Everything “just works” with MVC. If you need to do something, the solution is right at your fingertips.

Combine MVC with WebAPI and client-side JavaScript and you get a very powerful solution for communicating with the server. You can also communicate with your MVC controller, as well.

For instance, I set up a drag and drop system for panels on the page. All I had to do was set the draggable=”true” attribute on the

and wire up drag and drop functionality. As part of that, I made an AJAX call to /api/MyController/DoMove method and pass in a json formatted string containing the data required for the move. It’s a bit more involved as I used PartialViews to build the page.

It’s so nice to work with PartialViews and Actions instead of “stateful” controls. Everything is just nice and neat. It’s hard to explain until you actually use it every day and start to get the hang of it, but MVC is far superior to WebForms, hands down.

I’m sure WebForms will be around for a long time, but if you get the chance to start a new project, I strongly urge you to switch to MVC for your solution.