views:

10

answers:

1

On a page with update panel on a button click I have put some code to generate CSV .

When I click on Open in File dialog CSV file shown comes from browser cache.Every time it shows old csv.I have checked on server the csv file is created new but browser show old files.

A: 

A Simple way to avoid that is to add a random string on the end of the file, something like

/YourFile.csv?rnd=4707

or you can place some cache headers to not let it cache, for example

    Response.Cache.SetExpires(DateTime.UtcNow.AddYears(-4));
    Response.Cache.SetNoStore();
    Response.Cache.SetValidUntilExpires(false);
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
Aristos