How to Map URL with controller

Total Post:135


 977  View(s)
Rate this:
Hi Everyone,
I want that when we types “http://localhost/View/View Student/”, it goes to the “Student” Controller and invokes the DisplayStudent action. Please give me solution, how to map this action with controller,when we types a such type url.
Thank you.
  1. Re: How to Map URL with controller

    For solving above problem, we have adding an entry in to the routes collection using the maproute function. In Below i have underlined code which shows how the URL structure and mapping with controller and action is defined.

                   "View", // Route name
                   "View/ViewStudent/{id}", // URL with parameters
                   new { controller = "Student", action = "DisplayStudent", 
    id = UrlParameter.Optional });


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.