I have done these much for routing
routes.MapRoute(
name: "Hidden1",
url: "EditCategoryDetails/{categoryId}",
defaults: new { controller = "TestController", action = "EditCategory", categoryId = UrlParameter.Optional
});
routes.MapRoute(
name: "Hidden2",
url: "CategoryDetails",
defaults: new { controller = "TestController", action = "CategoryView"
});
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "LoginController", action = "Login", id = UrlParameter.Optional
});
After doin this the controller and action names were removed from the Url and were replaced by EditCategoryDetails and CategoryDetails respectively.
The problem is that after routing js and css won't work while the url is localhost/mywebsite/CategoryDetails
and is working when I place a slash(//) manually at the end of address bar
localhost/mywebsite/CategoryDetails/
After searching for the js and css problem I have done this too
routes.IgnoreRoute("{file}.css");
routes.IgnoreRoute("{file}.js");
routes.IgnoreRoute("{file}.jpg");
routes.IgnoreRoute("{file}.gif");
but no hope. Js and css get effected only when I manually add a slash(/) at the end on the address bar of browser.
Am including js and css in the _Layout.cshtml page as
<link href="~/Content/Site.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.7.1.js"></script>
etc.