Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi Team

I am struggling to route to my actioname and controllername, therefore it give me this error 'Error/Application'. How do i improve from this given logic i have;

What I have tried:

C#
<pre> // Route to Courses.

            routes.MapRoute(
                name:"Courses",
                url:"courses-registration/",
                defaults: new {controller="Home", action="CoursesRegistration", url=UrlParameter.Optional}

            );


//GET/Courses-List
       public ActionResult CoursesRegistration()
       {
           return View();
       }


<a class="btn btn-large btn-success" id="fire" href="@Url.Action("Courses-Registration","Home")">Create Courses</a>
                        <script type="text/javascript">    
                            $('#fire').on('click', function (e) {



                            });
                            </script>
Posted
Updated 17-Aug-20 5:22am

1 solution

Perhaphs going through following articles will help you understand on how routing works and to implement it. Have a look:
Routing to controller actions in ASP.NET Core | Microsoft Docs[^]
Routing in MVC[^]
Controllers And Routing In ASP.NET MVC[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900