We need to add a .html file which should be part of the root directory of our mvc app so i added the following
Route AnnouncementRoute = routes.MapPageRoute
("Announcement", "Announcement", "~/Announcement.html");
Route DefaultRoute = routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
The above code makes all the default actionlinks to add Announcement
http://localhost/Announcement?action=actionname&controller=controllername
How to make sure my actionlinks generated does not contain Announcement in the link as follows which is correct?
http://localhost/?action=actionname&controller=controllername
You can use
RouteCollection.IgnoreRoute()
. Here's a good usage example that does exactly what you're trying to do.