Recently, asp.net was developed and used in the gridview. However, after performing the update operation, even if the data is re-bound, the original data is displayed in the display and edit window, I thought it was not completely updated, but I finally found it was a cache problem. Now paste and share the solution.
Cancel Cache Cancel Client <Html> <Head> <Meta http-equiv = "Expires" CONTENT = "0"> <Meta http-equiv = "Cache-Control" CONTENT = "no-cache"> <Meta http-equiv = "Pragma" CONTENT = "no-cache"> </Head> Cancel the service appliance: Server: Response. Buffer = true; Response. ExpiresAbsolute = DateTime. Now. AddDays (-1 ); Response. Cache. SetExpires (DateTime. Now. AddDays (-1 )); Response. Expires = 0; Response. CacheControl = "no-cache "; Response. Cache. SetNoStore (); In Global: Protected void Application_BeginRequest (Object sender, EventArgs e) { HttpContext. Current. Response. Cache. SetNoStore (); } <% @ OutPutCache Location = "None" %> Page Base class: Public class PageBase: Page { Public PageBase (){} Protected override OnLoad (EventArgs e ){ Response. Cache. SetNoStore (); Base. OnLoad (); } } The simplest way In this forum on CSDN, some useless parameters are randomly added after the URL. I usually use the current time point, for example: Http: // xxx/xxx. aspx ?...... & Amp; time = date (). toString () Internet Explorer uses URLs to control the cache. This solves the problem. However, sometimes this method fails. The specific situation is analyzed. |