none
Cache de paginas RRS feed

  • Pergunta

  • Tenho minha aplicacao e mesmo colocando essas linhas no _layout.cshtml, meu cliente ainda ve as paginas antigas.

    <!DOCTYPE html>

    <html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="Cache-Control" content="no-cache">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Expires" content="0">

    COMO POSSO FORCAR COM QUE AS PAGINAS NUNCA SEJAM PEGAS DO CACHE ?
    MESMO QUE O BROWSER ESTEJA SETADO PRA ISSO, COMO SEMPRE FORCAR A APLICACAO A TRAZER AS ULTIMAS ALTERACOES ?

    Valeu

    quarta-feira, 11 de outubro de 2017 00:38

Respostas

  • Qual conteúdo está tendo problema com cache? CSS e JS? Caso sim, sugiro utilizar o recurso de Bundling to ASP.Net MVC, pois quando feito o deploy, a url destes conteúdos terão um parâmetro v alterado e o browser identificará como não sendo o mesmo conteúdo.

    Artigo para ajuda: https://msdn.microsoft.com/pt-br/library/dn168847.aspx?f=255&MSPPError=-2147217396

    Ex de configuração de bundles:

    public class BundleConfig
        {
            // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
            public static void RegisterBundles(BundleCollection bundles)
            {
                bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                            "~/Scripts/jquery-{version}.js"));
    
                bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                            "~/Scripts/jquery-ui-{version}.js"));
    
                bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                            "~/Scripts/jquery.unobtrusive*",
                            "~/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 http://modernizr.com to pick only the tests you need.
                bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                            "~/Scripts/modernizr-*"));
    
                bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
    
                bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                            "~/Content/themes/base/jquery.ui.core.css",
                            "~/Content/themes/base/jquery.ui.resizable.css",
                            "~/Content/themes/base/jquery.ui.selectable.css",
                            "~/Content/themes/base/jquery.ui.accordion.css",
                            "~/Content/themes/base/jquery.ui.autocomplete.css",
                            "~/Content/themes/base/jquery.ui.button.css",
                            "~/Content/themes/base/jquery.ui.dialog.css",
                            "~/Content/themes/base/jquery.ui.slider.css",
                            "~/Content/themes/base/jquery.ui.tabs.css",
                            "~/Content/themes/base/jquery.ui.datepicker.css",
                            "~/Content/themes/base/jquery.ui.progressbar.css",
                            "~/Content/themes/base/jquery.ui.theme.css"));
            }
        }


    Juliano Nunes - http://linkedin.com/in/julianonunes

    Lembre-se de clicar em "Votar como útil" e "Marcar como Resposta" caso tenha respondido sua dúvida.

    Remember to "Vote as Helpful" and "Mark as Answer" if your question has been answered.

    quarta-feira, 11 de outubro de 2017 11:52