0

Scenerio is that I want to hide the physical paths of javascript files in my MVC web application & I tried to do so as following in my RouteConfig!

routes.MapPageRoute("js", "js/base.js","~/scripts/applicationbase.js");

But, the path produces 404 error! And it worked when I removed the .js extension from the route like this:

routes.MapPageRoute("js", "js/base","~/scripts/applicationbase.js");

Does it means that a route with file extension can't be created? If not then how can I do that?

Rashid Ali
  • 587
  • 3
  • 13
  • How are you including the .js file in your view's html (/cshtml(etc)) – freedomn-m Feb 12 '16 at 10:04
  • I'm not sure what you are trying to achieve with MapPageRoute. You say this is an MVC application. MapPageRoute is meant to be used to define routes in a Web Forms app. If you use bundles, the actual path to the script files will be obscured anyway, e.g @Scripts.Render("~/bundles/jquery") the actual GET request URL will look something like: http://www.somemvcapp.com/bundles/jquery – pλul Feb 12 '16 at 10:20
  • Possible duplicate of [Dots in URL causes 404 with ASP.NET mvc and IIS](http://stackoverflow.com/questions/11728846/dots-in-url-causes-404-with-asp-net-mvc-and-iis) – NightOwl888 Feb 12 '16 at 11:23

0 Answers0