Last active
May 28, 2021 21:07
-
-
Save manoj-choudhari-git/5851d23dbbd96fce9899c72fff26c092 to your computer and use it in GitHub Desktop.
.NET Core Web Application - Use of Route attribute
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 attribute can also be placed on controller | |
public class SampleController : Controller | |
{ | |
[Route("/")] | |
[Route("Sample")] | |
[Route("Sample/Index")] | |
[Route("Sample/Index/{id?}")] | |
public ActionResult Index() | |
{ | |
return View(); | |
} | |
[Route("Sample/Details")] | |
[Route("Sample/Details/{id?}")] | |
public ActionResult Details(int id) | |
{ | |
return View(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment