-1

Sorry for my English... I have a problem with BundleCOnfig...

I added new script bundle:

bundles.Add(new ScriptBundle("~/bundles/js").Include(
           "~/assets/js/progress-bar/src/jquery.velocity.min.js",
            "~/assets/js/progress-bar/number-pb.js",
            "~/assets/js/progress-bar/progress-app.js",
            "~/assets/js/preloader.js",
            "~/assets/js/bootstrap.js",
            "~/assets/js/app.js",
            "~/assets/js/load.js",
            "~/assets/js/main.js"));

And add this code to _Layout.cshtml:

@Scripts.Render("~/bundles/js")

When I load page at localhost:21612/ no errors occur. Page displayed correctly:

Normal load

But if I load page at localhost:21612/Home/Index I get errors. And in path is added controller names:

Errors

I do not understand what the problem is, because the relative path to the script, why is inserted controller name?

UPDATE: Problem solved. The fact is that in the file main.js, all the way to the other scripts were installed as src="assets/, and should be src="/assets/

Venom
  • 97
  • 6

1 Answers1

0

The tilde has changed in MVC5 to do clever things with URL rewriting. I don't understand why it's doing this to you but if you're doing any URL rewriting, you can turn off overly clever fixing of on-page URLS, see this answer:

https://stackoverflow.com/a/12105210/7353829

Community
  • 1
  • 1
Edward D
  • 521
  • 3
  • 9
  • Thanks for the advice. The problem was of absolute paths in main.js file. I updated my post. – Venom Jan 02 '17 at 01:19