How to expire(remove) page caching in ASP.Net

June 7, 2010 at 4:25 pm 1 comment

Hey Folks,

Today I have faced one problem in my live website. It was showing old contents though I have changed the content in the web page. Then as I press F5 or Ctrl+F5 it will show me the right content. I have removed my cache from the browser but not succeed.

Then I have written below code in page level in Page_Load event, and then my page worked live never before. Here is the code:

VB:
‘Remove Page Caching…
Response.Expires = -1
Response.ExpiresAbsolute = Now()
Response.CacheControl = “no-cache”

C#:
//Remove Page Caching…
Response.Expires = -1;
Response.ExpiresAbsolute = DateTime.Now;
Response.CacheControl = “no-cache”;

Hurreeyyy !!!

Advertisement

Entry filed under: ASP.Net. Tags: .

COALESCE with DISTINCT in SQLServer User defined function to strip html in sql server 2005/2008

1 Comment Add your own

  • 1. Samir Varteji  |  June 7, 2010 at 4:35 pm

    Excellent Post !!

    Keep up the good work :-)

    It is really help full..

    Thanks,
    Samir Varteji

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

Feeds


Follow

Get every new post delivered to your Inbox.