How to prevent caching Ajax responses in ASP.NET

I created simple method to prevent caching. There is 2 methods , basically 1 sends, other prevents caching. See C# code

   public static void SetResponseNoCache(HttpResponse Response)
    {
        Response.Cache.SetExpires(new DateTime(1980, 11, 11));
        Response.Cache.SetLastModified(DateTime.Parse("1/1/2001 00:00:01AM"));
        Response.Cache.SetNoStore();
    }

    public static void SendToClient(HttpResponse r, string response)
    {      
        SetResponseNoCache(r);
        r.Write(response);
        r.End();
    }

Hope this helps

Igor Kononuchenko

Comments

You can use simple HTML-formatting tags(like <b>, <ul>, <code> and others)

Wow free space!
Super hosting provider might be here!

Is it Google?