Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ben Haynie 20 posts 50 karma points
    Jun 05, 2013 @ 23:47
    Ben Haynie
    0

    Disable caching for back office page

    I am extending the Umbraco Back Office by creating a new application, with associated tree's, etc.  As part of this, I am creating an ASPX page to show different settings. I appears that this page is being cached by Umbraco, and not updated.  The first time you click on the node on the tree, it will load the page (the page_load event of my page is hit, and the page is updated).  However, if you click off the node then come back and click it again, the node is not re-loaded.  It never hits the page_load event.

    This is an issue for me.  In this example, I am making changes to a config file, and the first time the user clicks on the node a bunch of default values are set.  When they click save, I update the config file.  If they click on the node again the page is supposed to re-load (pulling all of the values from the config file again), but because the page doesn't reload all of the default values are there again.

    Any ideas why this is?  Does it have to do with caching, or the javascript?  Is there any way to disable the caching, if that is the culprit, for just these pages in the back office?  Bear in mind that these are pages, not macro's.

    Here is the code from my Tree that lays out the Javascript:

    public override void RenderJS(ref StringBuilder Javascript)
    {
    Javascript.Append(@"
    function openBindingConfiguration(id) {
    UmbClientMgr.contentFrame('Plugins/GovAP/WCFConfiguration/EditWCFBindingConfiguration.aspx?id=' + id);
    }
    function openBehaviorConfiguration(id) {
    UmbClientMgr.contentFrame('Plugins/GovAP/WCFConfiguration/EditWCFBehaviorConfiguration.aspx?id=' + id);
    }");
    }

    Here is the code for rendering the nodes:

                            XmlTreeNode behaviorNode = XmlTreeNode.Create(this);
    behaviorNode.NodeID = behaviorName;
    behaviorNode.Text = behaviorName;
    behaviorNode.Icon = ".sprTreeDoc";
    behaviorNode.OpenIcon = ".sprTreeDoc";
    behaviorNode.Action = "javascript:openBehaviorConfiguration('" + behaviorName + "');";
    behaviorNode.NodeType = NodeTypeBehaviors;
    tree.Add(behaviorNode);

    Here is my Page_Load, which doesn't get run because it is never hit:

                protected void Page_Load(object sender, EventArgs e)
    {
    if (!Page.IsPostBack)
    {
    Bindings.WCFConfigurationBasicHttpBinding binding = null;
    string bindingName = Request.QueryString["ID"];
    #region Check that we have the binding name
    if (string.IsNullOrEmpty(bindingName))
    throw new Exception("Binding Name must be given");
    #endregion
    if (!string.IsNullOrEmpty(bindingName))
    {
    #region Open Config File
    var webConfigLocation = HttpContext.Current.Server.MapPath("~/web.config");
    XDocument configFile = XDocument.Load(webConfigLocation);
    #endregion

    binding = Bindings.WCFConfigurationBinding.GetBindingByName(configFile, bindingName) as Bindings.WCFConfigurationBasicHttpBinding;
    }
    else
    binding = new Bindings.WCFConfigurationBasicHttpBinding();
    SetUpForm();
    PopulateForm(binding);
    }
    }

    Thank you in advanced for any help.  As I have searched google and the forums, there are plenty of questions about macros, but I can't see anything specific to a back office page and not disabling all caching all together.

Please Sign in or register to post replies

Write your reply to:

Draft