Routes are mapped via Attributes.

Below we map our Index method to /welcome (as specified in the attribute).

But if you don't specify an url in the ShortRoute attribute, the action name will be used. Like it's done in the About method.

public class HomeController : Controller
{
	[ShortRoute("welcome")]
	public ActionResult Index()
	{
		return View();
	}

	[ShortRoute]
	public ActionResult About()
	{
		return View();
	}
}

Last edited Oct 11, 2011 at 12:05 PM by kirkov, version 3

Comments

No comments yet.