Tuesday, April 8, 2014

How to prevent cache in ASP.NET Single Page Application when use Javascript Ajax calls?

Turn off cache in Jquery Ajax call
        $.ajax({
            url: "url",
            cache: false,
            dataType: 'json',
            async: true,
            success: function (data) {
            },
            error: function (xhr, ajaxOptions, thrownError) {
            }
        });
    }

How to solve ASP.NET precompile problem, The type or namespace name does not exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)

Set Copy local to true for this project reference: System.Web.Mvc
And Clear solution

How to enable static content caching in ASP.NET?

Add following configuration into web.config file

      
    
Reference:
http://www.iis.net/configreference/system.webserver/staticcontent/clientcache


When run pagespeed, sometime will get following warning:
Leverage browser caching
Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over


Enable ASP.NET static content cache to improve speed