Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created May 28, 2021 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/b158ee0cc9e35441394655e378707d73 to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/b158ee0cc9e35441394655e378707d73 to your computer and use it in GitHub Desktop.
.NET Core Web Application - Combining attribute routes
[Route("[controller]/[action]")]
public class SampleController : Controller
{
[Route("~/")] // "/"
[Route("/Sample")] // "/Sample"
[Route("~/Sample/Index")] // "/Sample/Index"
[Route("Demo")] // "/Sample/Index/Demo"
public ActionResult Index()
{
return View();
}
// "/Sample/Abount"
public ActionResult About()
{
return View();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment