How to create a simple website in ASP.NET MVC
Part seven of a seven-part series of blogs

This blog explains the steps you'll need to follow to create a simple one page website in ASP.NET MVC. The aim of the blog is not to act as a tutorial, but to help people choose between ASP.NET MVC and classic ASP.NET.

  1. An overview of creating a website in ASP.NET MVC
  2. Creating an ASP.NET MVC website
  3. Creating an entity model in MVC
  4. Creating a view model
  5. Ensuring MVC shows the right page - router and controller
  6. Creating our view
  7. Conclusion (this blog)

Posted by Andy Brown on 16 June 2014

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

Conclusion

In ASP.NET webforms (classic ASP.NET), you have one file for each web page, and this contains all of the HTML and code that the web page needs in order to work.

In MVC you have to create:

Part of MVC Notes
A router ... to determine which controller should handle any page request.
A controller ... to create a view model class to be used by a view, and then return the view itself.
A view model The class upon which the view should be based.
A view The HTML and C# file determining what the browser should display.

Along the way, I've had to show (without much explanation):

  • The LINQ database language.
  • Classes and namespaces.

I think what'd I'd say in conclusion is this: MVC is a better tool for creating websites, but don't use it unless you're very comfortable at programming classes!

This blog has 0 threads Add post