Samra Samra - 7 months ago 58
Javascript Question

bootstrap - Failed to load resource

I have an aspnet mvc application My bootstrap bundle could not be loaded in browser

BundlesConfig

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
...
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js",
"~/Scripts/bootstrap-multiselect.js"));


_Layout.cshtml

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Scripts.Render("~/bundles/jquery")

@Scripts.Render("~/bundles/modernizr")
</head>
<body>
<div> ... <div>
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
</body>
</html>


Now when i load the page view source says

<script src="/Home/~bundles/bootstrap"></script> Failed to load resource


Why is it giving the wrong address all other scripts are found

Answer Source

In the below link , the answer mention by the gone coding user , has clearly explained what are the ways we can do ,to avoid this error .

MVC Bundling - Failed to load resource

Kindly take a look and let me know whether that solved your problem .

Thanks karthik