1

I have the following controller action:

public ActionResult Details(string pk)
        {
            IEnumerable<ContentDetail> model = null;
            try
            {
                model = _content.Details(pk);
                if (model.Count() > 0)
                {
                    return PartialView(getView(pk) + "Details", model);
                }
            }
            catch (Exception e)
            {
                log(e);
            }
            return Content("No records found");
        }

I call this with the following routine:

$.ajax({
        cache: false,
        url: "/Administration/" + table + "s/Details",
        data: { pk: partitionKey },
        dataType: 'html',
        success: function (responseText) {
            $('#detailData').html(responseText);
            $(".updatable")
                .change(function (e) {
                    var type = $(this).attr('id').split('_')[0];
                    updateField(table, $(this), type);
                });
            $('.dialogLink')
                .click(function () {
                    dialogClick(this);
                    return false;
                });
        },
        error: function (ajaxContext) {
            ajaxOnFailure(ajaxContext)
        }
    });

What I notice is that sometimes when I put a break point on the first line of the controller action then it does not seem to stop at the breakpoint. Is it possible the results are being cached by MVC and how could I stop this from happening while I debug?

2 Answers2

0

Check for any variation of OutputCache being set on the controller itself or, if present, a base controller all your controllers may inherit from.

I've also noticed IE likes to cache things and found the only way to alleviate this is doing to the developer window and clearing the cache (or ctrl+shift+del)

Try adding cache:false to your .ajax call and see if that has any bearing (jQuery will append a timestamp variable making each call unique). Nevermind, just noticed you have it included. Must be getting late here--sure sign it's bed time when I miss things like this.

Brad Christie
  • 100,477
  • 16
  • 156
  • 200
0

Load up fiddler and see if the request is even coming back from the browser. Ideally you'll want I write out no cache headers through one of the many methods mentioned here Disable browser cache for entire ASP.NET website

Community
  • 1
  • 1
Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71