forum

Home / DeveloperSection / Forums / MVC routing the index page

MVC routing the index page

Allen Scott186519-May-2015

I have very simple mvc application

When I type  http://localhost:8080

The following route in the routeconfig takes me to the Home controller

routes.MapRoute(
                    name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

When I type the following, get 404 error.

http://localhost:8080/jhon

I want to map this request to Home Controller's Get Action with name function (see below). How do I go about doing that?

public Person Get(string name)
{
        PersonRespository db = new PersonRespository();
        return db.GetPerson(name);
 }

Updated on 19-May-2015

Can you answer this question?


Answer

1 Answers

Liked By