Created
May 28, 2021 21:08
-
-
Save manoj-choudhari-git/b158ee0cc9e35441394655e378707d73 to your computer and use it in GitHub Desktop.
.NET Core Web Application - Combining attribute routes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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