what controls IE caching when i do not add any code to manage the caching settings

I have the following inside my asp.net mvc view:-

<div class=" b" >Show   @Html.DropDownList("type", new SelectList(ViewBag.type, "Value", "Text", "" ), new { @id= "typeOptions",@class="SmallDropDown3"}) Requestors.
                        <img src="~/Content/sortloading.gif" class="loadingimage" id="progressSort3" /></div>  

@Html.Partial("_GetRequestors", Model)
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
<script>
        $("body").on('change', '#typeOptions', function () {


            $('#progressSort3').show();

            $.ajax({
                type: "Get",
                url: '@Url.Action("GetRequestors","Customer")',

                data: { id: "@ViewBag.AccountID", page: "1", type: $("#typeOptions").val() },

                success: function (html) {
                    $('#RequestorTable').html(html);
                    $('#progressSort3').hide(); //This could also be dialog("open") depending on the version of jquery ui.

                }
            });
        });
    </script>

Which mainly display a dropdownlsit which will initiate an Ajax call when the list items changed. Here is the action method that will be called:-

public ActionResult GetRequestors (int id = 0,int page=1,string type="")
        {
            int pagesize;
            ViewBag.type = ViewBag.PagedSizeOptions = new PageOptions().RequestorTypeOptions;
            bool succeed = int.TryParse(System.Web.Configuration.WebConfigurationManager.AppSettings["TechPageSize"], out pagesize);
           var aUser = repository.populateRequestorDetials2(id,type).OrderBy(a=>a.FIRST_NAME).ToPagedList(page, pagesize);

           ViewBag.AccountID = id;
           ViewBag.currenttype = type;
           if (Request.IsAjaxRequest())
           {

               return PartialView("_GetRequestors", aUser);
           }
           return View(aUser);
  }

currently seems that IE will cache the result for a long time, and when changing the dropdpwnlist options , IE will always show the cached result for the same dropdown item, even doing a hard refresh (ctrl-f5) will not delete the cached result… So i have
mainly these two questions :-

  1. for how long IE will keeps the cached data ?

  2. as shown in my above code, i did not specify any code to manage the cache (neither i used "cache:false" as an ajax parameter,  nor i added a cache profile to my action method). so in this case what force IE to cache the result .(baring in mind that using
    other browsers will never cache the result and they will always send an ajax request to the server ).

can anyone advice on these issues?

Thanks.

Hi,

the below post is help you to understand the cache

http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx

life time of cache from the above blog

RFC2616 recommends that servers limit freshness to one year, some servers send Cache-Control directives specifying a much longer freshness lifetime. Prior
to IE9
, Internet Explorer would treat as stale any resource with a Cache-Control: max-age value over 2147483648 (2^31) seconds, approximately 68 years.

With Internet Explorer 9, we now accept any value up to 2^63 for the max-age value, although internally the freshness interval will be truncated to 2^31 seconds.

sen338

Hi,

the below post is help you to understand the cache

http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx

life time of cache from the above blog

RFC2616 recommends that servers limit freshness to one year, some servers send Cache-Control directives specifying a much longer freshness lifetime. Prior
to IE9
, Internet Explorer would treat as stale any resource with a Cache-Control: max-age value over 2147483648 (2^31) seconds, approximately 68 years.

With Internet Explorer 9, we now accept any value up to 2^63 for the max-age value, although internally the freshness interval will be truncated to 2^31 seconds.

i do not think you understand my question,, are you saying that i will keep receiving the same result for the ajax request for one year !!!

so mainly i want to know what forced IE to cache the result even i did not specify anything to force browser cache as i mentioned before. so this raised a question on how long will IE keep caching the Ajax response ? and is there
a way to control this ? . my question is not how i can enable/disable caching , what i am asking about is what control the caching for IE when no caching settings are defined as in my case?
 

Leave a Reply