Time to get my hand dirty with some new web app.
I setup a new account on somee, that hosts asp.net 4 apps for free.
Uploaded a fresh new “hello world” app created by Visual studio 2010.
Wanting to make something with asp.net and MVC I configured the web app to also support MVC 3 following instruction foun here. Nothing fancy, only few steps to get things done.
To ease this process I created another web app configured as MVC 3 and compared the two.
So I added references to appropriate assembly (some assembly not found directly, but for System.Web.Mvc.dll under C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll).
Then modified web.config adding relevant tags.
Same thing for global.asax.cs, registering filters into the app.
Also modify the .csproj file and especially add proper ProjectTypeGuids i.e.
To start quickly I followed the pluralsight training video as suggested by Scott Guthrie.
In the /Controllers dir there’s (guess what..) the controllers. Named with the name we choose terminating with a “Controller” string.
Views are stored under the /Views dir, grouped in a dir named as the controller.
So if we want to create a “Hello” controller the directory structure will be:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace FitCalc.Controllers
- public class HelloController : Controller
- // GET: /Hello/
- public ActionResult Index()
- ViewBag.Message = "Welcome to ASP.NET MVC!";
- return View();
.cshtml is the razor file implementing the view.
The URL for this view is /Hello/Index.