2 Replies Latest reply on Jul 28, 2011 2:31 AM by Kumar Pratik

    How to clear a Cache of the browser

    Guru J

      Hi,

       

      We are working in a application whose technologies are Flex 4.0 and .Net 2010.

      We are using .Net WCF Service for interacting with backend from the Flex front end.

       

      We are situation like, we need to show the a link (for e.g., "admin functionalities"), only for admin users and the same link should be hidden for rest of them.

       

      Consider the Scenario,

       

      Scenario 1:

       

      1. We are logging into system as admin and logging out. [Note: The link is visible]

      2. Without closing the browser window, we are logging in as normal user. [Note: The link is hidden]

       

      Scenario 1 is working as expected.

       

      Scenario 2:

       

      1. We are logging into System as normal users and logging out. [Note: The link is hidden]

      2. Without closing the browser window, we are loggin in as admin user. The link is not visible.

       

      Scenario 2 is not working as expected.

       

      So what I did is,

       

      1. I have added the following in the Index.html,

       

        <meta http-equiv="Cache-Control" content="no-cache">
        <meta http-equiv="expires" content="0">

      this is not working at all, still the same issue exists.

       

      2. I have explictily reloading the application on log out using,

       

      -->

           var bm:IBrowserManager=BrowserManager.getInstance();               
          bm.init("", "Welcome!");
          var tmpURL:URLRequest = new URLRequest(bm.url.toString());
          navigateToURL(tmpURL,"_self");

      <--

       

      this is working only for IE, but not for other browsers like Chrome, Safari and Mozilla.

       

      Please let us know if any one has suggestion or solution for the above.

       

      Regards,

      Guru

        • 1. Re: How to clear a Cache of the browser
          pauland Level 4

          You don't say whether the admin link is in the HTML or part of the application, but I guess that you have seperate links in the HTML and somehow the login process is outside Flex?

           

          If the login process was inside the Flex app, I would guess that there wouldn't be a problem.

           

          The usual trick to force a reload of the page when navigating via a supplied link URL is to add a cachebuster string to make the signature of the URL differrent every time. Have a go with google and cachebuster.

          • 2. Re: How to clear a Cache of the browser
            Kumar Pratik Level 1

            You are facing this issue only in IE and other browsers are working fine correct? This is indeed beacuse of cache.. How you are connecting with database?Make the URL unique everytime you interact with database: E.g-

             

            request.URL = "http://localhost/test/test1.php?flush="math.random();