Categories
Chrome CSS Development jQuery MVC

MVC 5 bundled css works fine in chrome, but not any other browser

As the title says, when I try to load my site in any other browser apart from chrome, the site has no styling.

My bundles don’t contain the name of the folder they’re in (I know this is a common issue with bundling) and the fact that chrome loads the bundles fine shows there isn’t an actual issue with the bundle.

If I go to the folder path for the bundled css (e.g /Content/Allcss?v=Eze8tJIZiYOA13hExK1v1hyjgjptGZUujs0uqxcErPY1) in chrome it loads the css stylesheet, however in all other browsers I just get a “Object reference not set to an instance of an object”.

Head of layout:

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title</title>
    <link 
       href="https://unpkg.com/tailwindcss@("@^1.0/dist/tailwind.min.css")" 
       rel="stylesheet">
    <link href="https://fonts.googleapis.com/css? 
       family=Montserrat:400,800&display=swap" rel="stylesheet">
    @Styles.Render("~/Content/Allcss")
    @Scripts.Render("~/bundles/modernizr")
 </head>

and my bundle config:

public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            "~/Scripts/jquery-{version}.js"));

        bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
            "~/Scripts/jquery.validate*"));

        // Use the development version of Modernizr to develop with and learn from. Then, when you're
        // ready for production, use the build tool at https://modernizr.com to pick only the tests you need.
        bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
            "~/Scripts/modernizr-*"));

        bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
            "~/Scripts/bootstrap.js"));

        bundles.Add(new StyleBundle("~/Content/Allcss").Include(
            "~/Content/bootstrap.css",
            "~/Content/site.css"));
    }

Update::

Turns out my PostAuthenticateRequest method was trying to authorize viewing the css and failing, this has been solved

Leave a Reply

Your email address will not be published. Required fields are marked *