I have a URL like below and I need to remove the controller name (myController). I've use several fixes but none fixed the issue. Please help me guys..
http://foldername.example.com/foldername/myController/my-page
'example.com' is the domain and all the files related to the site is inside 'foldername' folder. 'my-page' is the view name
In the end I need the above URL to be like below.
Thank in advance guys..!!
You should map new route in the global.asax (add it before the default one), for example:
You could try inverting the routes definition by placing the more specialized route first. Also you probably didn't want to hardcode the action name as action but rather use the
{action}
placeholder:Follow the below links :
Link 1
Link 2
Link 3
Enable attribute routing by adding following line before route.MapRoute in RouteConfig.cs file
Then add the Route Attribute to each action with the route name, like:
Use Routing in the
global.asax
and in controller
add following to
RouteConfig.cs