dimanche 10 mai 2015

My view does not load CSS/JS files outside Views folder

I have a view inside my Views folder in my MVC 3 application which loads CSS, Images and JS files from a folder at root level of the application. On running the View get the following output, I tried using

  • <link href="@Url.Content("~/RootFolder/styles.css")" rel="stylesheet" type="text/css" /> for CSS and below code which did not work

    <script src="@Url.Content("~/RootFolder/jquery-1.8.3.min.js")" type="text/javascript"></script>

    • I added in my views Web.config file

Cannot load JS,CSS and images from root folder

I cannot load CSS/Images/JS files from the root folder, But if I place the cshtml file in the root folder where CSS/Images/JS files are present the application works as expected displaying everything. Can you please help me resolve this issue

Thanks for your help :-)

UPDATE: My HTML code looks as shown in the below image

HTML Code looks like this

My folder hierarchy in the application looks as

Folder Hierarchy in my application

Aucun commentaire:

Enregistrer un commentaire