CSS files are not showing on server - ASP.NET MVC Bundles error. 403 - Forbidden: Access is denied -


my mvc 4 application works fine on local computer.

however, css files not working after publish (are not affecting layout of website).

i can see css files on server.

when @ source code, can see

<link href="/content/css?v=fxcdhaogpdvcroxkmfewgqggo9ucfzckn3pan8boizi1" rel="stylesheet"/> 

where on local computer, source code shows as

<link href="/content/css/myfile.css" rel="stylesheet"/> <link href="/content/css/myfile02.css" rel="stylesheet"/> 

so, in source code view on server, clicked on content/css?v=fxcdhaogpdvcroxkmfewgqggo9ucfzckn3pan8boizi1 , browser took me 403 - forbidden: access denied.

i adding css files bunldeconfig.cs class

    public class bundleconfig     {         // more information on bundling, visit http://go.microsoft.com/fwlink/?linkid=254725         public static void registerbundles(bundlecollection bundles)         {             bundles.add(new scriptbundle("~/bundles/javascript").include(                         "~/scripts/1.9.1.js",                         "~/scripts/jtools.js",                         "~/scripts/script.js"                         ));              bundles.add(new stylebundle("~/content/css").include(                 "~/content/css/website.css",                  "~/content/css/banner.css",                  "~/content/css/reusable.css",                 "~/content/css/lists.css",                 "~/content/css/tooltip.css",                 "~/content/css/overlay.css"                 ));           }     } 

my question is, assuming isn't issue server (it has been working fine until recently) there wrong code?

your problem using ~/content/css bundle alias in new stylebundle("~/content/css"), while path exists.

so when requesting <link href="/content/css?...> asking directory listing , forbidden.

try using else, new stylebundle("~/content/styles").

note: if use ~/content/styles alias may have issues relative urls in .css files. may seem odd, may better use ~/content/css/somealias


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -