locked
prevent cache for part of the page RRS feed

  • Question

  • User1024191908 posted

    I have a usercontrol that is used on some of my pages and I want only that part of my pages not to be cached.

    how can I do that?

    thanks in advance.

    Sunday, March 11, 2018 7:29 AM

Answers

  • User-832373396 posted

    <g class="gr_ gr_13 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="13" data-gr-id="13">Hi</g> <g class="gr_ gr_5 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="5" data-gr-id="5">anooshiravan</g>,

    a <g class="gr_ gr_20 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="20" data-gr-id="20">usercontrol</g> that is used on some of my pages and I want only that part of my pages not to be cached.

    Sir, I guess that this is what you need.

    • To control web page caching, across all browsers?

    Using ASP.NET-MVC

    Response.Cache.SetCacheability(HttpCacheability.NoCache);  // HTTP 1.1.
    Response.Cache.AppendCacheExtension("no-store, must-revalidate");
    Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0.
    Response.AppendHeader("Expires", "0"); // Proxies.

    Using ASP.NET:

    Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
    Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0.
    Response.AppendHeader("Expires", "0"); // Proxies.

    Hope it is good for you and let me know if any question :)

    With regards, Angelina Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 12, 2018 7:38 AM
  • User-832373396 posted

    is the code in Page_Load()?

    Yeah, put in Page_Load so that only loading one time.

    Bests,

    Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 12, 2018 8:28 AM

All replies

  • User-832373396 posted

    <g class="gr_ gr_13 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="13" data-gr-id="13">Hi</g> <g class="gr_ gr_5 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="5" data-gr-id="5">anooshiravan</g>,

    a <g class="gr_ gr_20 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="20" data-gr-id="20">usercontrol</g> that is used on some of my pages and I want only that part of my pages not to be cached.

    Sir, I guess that this is what you need.

    • To control web page caching, across all browsers?

    Using ASP.NET-MVC

    Response.Cache.SetCacheability(HttpCacheability.NoCache);  // HTTP 1.1.
    Response.Cache.AppendCacheExtension("no-store, must-revalidate");
    Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0.
    Response.AppendHeader("Expires", "0"); // Proxies.

    Using ASP.NET:

    Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
    Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0.
    Response.AppendHeader("Expires", "0"); // Proxies.

    Hope it is good for you and let me know if any question :)

    With regards, Angelina Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 12, 2018 7:38 AM
  • User1024191908 posted

    thanks.

    just to make sure.

    is the code in Page_Load()?

    Monday, March 12, 2018 7:56 AM
  • User-832373396 posted

    is the code in Page_Load()?

    Yeah, put in Page_Load so that only loading one time.

    Bests,

    Jolie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 12, 2018 8:28 AM