locked
Caching behaviour of ASP.NET page having iframe RRS feed

  • Question

  • Hi,

    Application contains page that holds two iFrames in it, page contains the jQuery UI tabs and these frames toggle to each other when user switches between tabs. So page markup somewhat looks like following code

    <%@ Page Title="AX" Language="C#" MasterPageFile="~/Master/User.Master" AutoEventWireup="true"
    CodeBehind="AX.aspx.cs" Inherits="AX" %>
    
    <asp:Content ID="CM" ContentPlaceHolderID="M" runat="server">
    	<div class="tab_container">
    		<div class="main_content">
    			<iframe id="Edit" frameborder="0" width="100%" class="article_frames"
    			        scrolling="no" runat="server" clientidmode="Static">
    			</iframe>
    			<iframe id="Review" frameborder="0" width="100%" class="article_frames"
    			        scrolling="no" runat="server" clientidmode="Static">
    			</iframe>
                     </div>
            </div>
    </asp:Content>

    Source of frames is set dynamically, application when launches - code behind of landing page sets the source of Edit iFrame. When user switches tab on browser javascript code sets the source of Review frame and hides the Edit frame. 

    Scenario is user switches to Review tab and further navigates to some other site by changing url in browser, and when he press browser back button landing page is opened having source set to both of the frames, here I expect when landing page launched only one frame should be loaded. I suspect Landing page is read from cache so I added following code to ensure page response should not be cached either on client or server

    		HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(false);
    		HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
    		HttpContext.Current.Response.Cache.SetNoStore();
    		HttpContext.Current.Response.Cache.SetNoServerCaching();
    		Response.Cache.SetExpires(DateTime.Now);
    		Response.Cache.SetValidUntilExpires(true);

    Can somebody tell me how I can avoid loading of both the frames or make request behave as if it is fresh request?



    • Edited by Yogesh Rain Friday, December 18, 2015 1:18 PM
    • Moved by DotNet Wang Monday, December 21, 2015 2:32 AM
    Friday, December 18, 2015 1:13 PM

Answers