asked    Joyce     2018-10-12       model-view-controller       21 view        1 Answer

[SOLVED] MVC Bundle Minification returns 404 with Umbraco 7.2.1

I'm unable to work out why i'm getting the 404, if i turn

BundleTable.EnableOptimizations = false;

then everything works OK, but set it to

BundleTable.EnableOptimizations = true;

then I get

Failed to load resource: the server responded with a status of 404 (Not Found)

I cannot work this out and it only happens for css, js bundle works ok any help appreciated.

I'm Using VS2015 and Umbraco 7.2.1

using System.Web.Optimization;

namespace Web.UI
{
    public class BundleConfig
    {
         For more information on bundling, visit http:go.microsoft.comfwlink?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~bundlesjquery").Include(
                         "~Scriptsjquery-{version}.js"));

            bundles.Add(new ScriptBundle("~bundlesjqueryval").Include(
                        "~Scriptsjquery.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 http:modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~bundlesmodernizr").Include(
                        "~Scriptsmodernizr-*"));

            bundles.Add(new ScriptBundle("~bundlesbootstrap").Include(
                      "~Scriptsbootstrap.js",
                      "~Scriptsbootstrap-datepicker.js",
                      "~Scriptsrespond.js"));

            bundles.Add(new StyleBundle("~Contentcss").Include(
                      "~Contentbootstrap.css",
                      "~Contentfont-awesome.min.css",
                      "~ContentPagedList.css",
                      "~Contentbootstrap-datepicker.css",
                      "~Contentsite.css"));

            BundleTable.EnableOptimizations = true;
        }
    }
}

using System.Web.Optimization;
using Umbraco.Core;

namespace Web.UI
{
    public class ApplicationEvents : ApplicationEventHandler
    {
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }
}

<add key="umbracoReservedPaths" value="~umbraco,~install,~bundles" >


@inherits UmbracoTemplatePage
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" >
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title<title>
    <meta name="description" content="@ViewBag.Description" >
    @Styles.Render("~Contentcss")
    @Scripts.Render("~bundlesmodernizr")
<head>
<body>

    <div class="container">
        <div class="row">
            <div class="col-lg-10" style="text-align: center">
               <img src="" alt="Logo" width="300" >              
            <div>
        <div>
        <div class="row">
            <div id="custom-bootstrap-menu1" class="navbar navbar-default " role="navigation">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <a class="navbar-brand" href=""><i class="fa fa-home">&nbsp;<i><a>
                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-menubuilder">
                            <span class="sr-only">Toggle navigation<span><span class="icon-bar"><span><span class="icon-bar"><span><span class="icon-bar"><span>
                        <button>
                    <div>
                    <div class="collapse navbar-collapse navbar-menubuilder">

                    <div>
                <div>
            <div>
        <div>
    <div>
    <div class="container bottomPadding">
        @RenderBody()
    <div>
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <footer role="navigation">
                    <p>@Umbraco.RenderMacro("CopyrightDate")<p>
                <footer>
            <div>

        <div>
    <div>
    @Scripts.Render("~bundlesjquery")
    @Scripts.Render("~bundlesjqueryval")
    @Scripts.Render("~bundlesbootstrap")

    @RenderSection("scripts", required: false)
    @RenderSection("datepicker",false)

<body>
<html>

Namespace

<add namespace="System.Web.Optimization">

added to web.config in Views Folder

  1 Answer  

        answered    Hunter     2018-10-12      

Found answer to my problem, the following link explains





Your Answer





Set date for Umbraco date picker using jQuery

Am creating a button for an Umbraco back-end content editing page that will retrieve a load of data from another database and auto-populate a few of the fields. However some of the fields use the Umbraco datepicker. I can change the value of the text box but when I click to view the datepicker calendar, it has the wrong date selected. How can I set the date of the datpicker so it matches what's in the text box rather than just the change what's in the textbox?Thanks Think I've got it. Once change value of textbox call .change() on the text box and this will update the da...
 jquery                     1 answers                     1 view
 2018-10-12         Stephanie

Jquery Ajax Call to send data to the method when the a href clicked

I am trying to send the language type clicked from my master page into the surfacecontroller in the App_code folder. My HTML is like this below:<div class="navbar-topbar clearfix"> <div class="h5 pull-right"> <span class="linkCA"> <strong>CA</strong> <a class="lang=en-CA" href="@NewUrlLink">EN</a> | <a class="lang=fr-CA" href="@NewUrlLink">FR</a> </span> <span class="linkUS"> <strong>US</strong> <a class="lang=e...
 javascript                     1 answers                     2 view
 2018-10-12         Hedda

PartialView inside modal Popup

I am trying to open PartialView inside jquery modal Popup on a link click event in my MVC, Umbraco project. The partial view loads fine however submitting the button inside modal popup calls the ActionMethod correctly but then instead of opening the modal popup in the same parent window it launches it in a new window. No sure what i am doing wrong here. Below is my code:Partial View @inherits Umbraco.Web.Mvc.UmbracoViewPage<Source.Models.SchoolFindYouModel><script> $(function () { $("#dialog-modal-school").dialog({ autoOpen: false, ...
 jquery                     1 answers                     3 view