MVC Sample Application - Part5

Working with View          

            Now lets modify the controller like following and then run.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace FirstMVCApplication.Controllers
{
    public class FirstController : Controller
    {
        //
        // GET: /First/
        public string Index()
        {
            return "Hello MVC";
        }
    }
}

           If we run the above code in Visual Studio we see a out put like following.

Error

            We will get a error because MVC Route Handler not found default path  in RouteConfig.cs.
But if we enter URL like /First/Index then we will see a output.

String Output

              Another way is just change the Controller name in RouteConfig.cs. The RouteConfig.cs file like following.

Route Config

             Here we changed controller name Home to First because we didn't create a Home Controller(We have First Controller) and run application then default Controller gives output.
Here generated output is not Html(it's a string result).