I have my js files inside areas and I cannot access them. When I move them outside the MVC areas then I can access.
I have tried the following:
- Different naming of js files – doesn’t solve problem
- Check to see if they exist on the server – they do
- Access file directly from within IIS manager on server – they won’t open and return not found
- Access same files directly from within IIS manager on server but when files are in script directory – They open in browser
- Used the route checker – When I try to access the file it does not open route debug and instead just says “404”
This works:
<script src="@Url.Content("~/Scripts/jquery/_Roles.js")" type="text/javascript"></script>
This does not work:
<script src="@Url.Content("~/Areas/Administration/Scripts/Roles/_Roles.js")" type="text/javascript"></script>
Could there be something different about files under the Areas folder that blocks scripts?
Why put your scripts in the Areas section? I have an mvc site with an area as well, but I still keep my scripts in the Scripts folder.
My suggestion is to rethink the reason you’re organizing your content that way and consider moving all external .js files to the Scripts folder.