Optimize load of pages MVC 5

-1

Cordial greeting, how can it be optimized so that javascript files like jquery and other libraries common to the whole solution so that they do not recharge each time you navigate between views?.

As can be seen in the image, the download times of the browser are very high, and if done only once, it is fine, but this is repeated every time you navigate between pages

I am working with MVC 5, in the BundleConfig I have the BundleTable.EnableOptimizations = true; and the reference to javascript is in the _Layout.

In the BundleConfig I have reference the libraries that I use, which are static

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

        bundles.Add(new ScriptBundle("~/bundles/knd").Include(
      "~/js/kendo.all.min.js",
      "~/js/messages/kendo.messages.es-CO.min.js",
      "~/js/cultures/kendo.culture.es-CO.min.js"));

BundleTable.EnableOptimizations = true;

Thanks for the guidance

    
asked by Jorge 06.08.2018 в 16:26
source

1 answer

0

The problem I had was that the javascript files were not being cached, causing them to download each time the controller was changed, so I solved it in the following way (if anybody knows any other welcome).

in the Global.asax file

Modified the:

Response.Cache.SetCacheability(HttpCacheability.NoCache);

By

Response.Cache.SetCacheability(HttpCacheability.Private);

Which allows to enable or disable and allows adding other options.

I also disabled:

Response.Cache.SetNoStore();

With this I was able to solve the problem and the response time or performance of the application was noticeably improved.

    
answered by 09.08.2018 в 22:23