umbraco usercontrol macro caching and postback problem
We are running Umbraco 4 and we have ASP.NET 3.5 on Windows Server 2003
Hi Guys,
I'm having a problem with a page im developing in umbraco. Im fairly new to it so would really appreciate some guidance.
the problem seems to be connected to the way umbraco caches pages.
what i have is a stockist locator map (a map of australia in my case).
from this page, the user can select a region to see stockists within that area.
i have a big fat search button along with some checkboxes for the user to choose what region they want to search in.
when i check say 'sydney' and hit my search button, all is well. it returns the results i would expect.
but... if i go and click the search button straight away (again) - then the search results disappear.
its almost like umbraco is doing some weird caching thing. ive tried fiddling with the cachine settings within the developer area (i.e. 'Cache Period'), but havent spotted any consistant patterns which shed light on the problem.
oh, another thing - its not executing the page load and pageInit events (when retrieving from the cache).
any help would be greatly apprecaited as im on a deadline and my boss will have my soul if i dont deliver :)
The code works in Visual Studio with the built in IIS server.
The ASPX control sits within a user control which is an ASCX.
To update the search results we postback using an ASP button and read the checkbox values set before the postback. Then we do some stuff with xmldatasource and xpath and display the results in a repeated control.
Once the code is integrated into umbraco when cache timeout (in macro settings) is set to 0. Setting a search up (setting the checkboxlist) and then clicking the search button results in results displayed BUT on the second press of the search button even if the checkbox selections change the page does not postback correctly. In fact what is happening is NO POSTBACK and NO PAGE INIT or PAGE LOAD. The page is being cached by Umbraco in some way and the visual elements are being reloaded but there is no normal code execution. In fact when we tested session variables they also disappear.
We have attempted to change the cache timeout to 5 seconds and within the 5 seconds we can click the search button 3 times in quick succession in one second intervals and it works and on the fourth time the page is broken as above etc. Also tried doing a search and waiting until the 5 seconds are up and then trying the search and get a broken page.
We have changed the cache to 60 and within the the 60 seconds we only get a broken page no matter how many times we press the search button.
Hence as described before the results are unpredictable.
We would love to be able to turn caching off but we're not sure if there is such an option?
Try using a tool like LiveHTTPHeaders for Firefox to make sure the requests are being made from your browser. Also, check your IIS log file to check the request is getting to the server.
You can also add your controls directly on to the templateand not through a macro, this will remove any macro caching Umbraco is performing.
We have already tried adding the user controls directly to the template. I think that there is also template caching because the same thing happens.
Running the code directly from IIS is ok though.
All of our companys code is experiencing the same problem not just this one that I am working on. :(
I also read about how macro caching works and watched the 4 videos that are provided on macro caching.
I tried setting public properties and all that.
But really when I click on the page and then try a postback with cache timeout set to 0. None of the code behind will execute because a new page is loading. If cache set to > 0 then postback goes to the cached page.
We are using umbraco 4.0.2.1 and I have asked if we can set up the beta here in case anything is fixed
But the only thing I can assume at present is that Umbraco does not like dynamic pages that postback and would prefer to cache pages correctly only if they are visited from another page and have macro parameters/values set in the query string.
But really when I click on the page and then try a postback with cache timeout set to 0. None of the code behind will execute because a new page is loading. If cache set to > 0 then postback goes to initial cached page not the correct page.
umbraco usercontrol macro caching and postback problem
We are running Umbraco 4 and we have ASP.NET 3.5 on Windows Server 2003
Hi Guys,
I'm having a problem with a page im developing in umbraco. Im fairly new to it so would really appreciate some guidance.
the problem seems to be connected to the way umbraco caches pages.
what i have is a stockist locator map (a map of australia in my case).
from this page, the user can select a region to see stockists within that area.
i have a big fat search button along with some checkboxes for the user to choose what region they want to search in.
when i check say 'sydney' and hit my search button, all is well. it returns the results i would expect.
but... if i go and click the search button straight away (again) - then the search results disappear.
its almost like umbraco is doing some weird caching thing. ive tried fiddling with the cachine settings within the developer area (i.e. 'Cache Period'), but havent spotted any consistant patterns which shed light on the problem.
oh, another thing - its not executing the page load and pageInit events (when retrieving from the cache).
any help would be greatly apprecaited as im on a deadline and my boss will have my soul if i dont deliver :)
Are you sure this is an Umbraco issue?
Try creating a .aspx page and adding your controls on to it, do you experience the same issues?
How does your search control inform your map of the search values? Does it modify the URL, Request or ViewState variables?
Cheers,
Chris
Hi Chris,
The code works in Visual Studio with the built in IIS server.
The ASPX control sits within a user control which is an ASCX.
To update the search results we postback using an ASP button and read the checkbox values set before the postback. Then we do some stuff with xmldatasource and xpath and display the results in a repeated control.
Once the code is integrated into umbraco when cache timeout (in macro settings) is set to 0. Setting a search up (setting the checkboxlist) and then clicking the search button results in results displayed BUT on the second press of the search button even if the checkbox selections change the page does not postback correctly. In fact what is happening is NO POSTBACK and NO PAGE INIT or PAGE LOAD. The page is being cached by Umbraco in some way and the visual elements are being reloaded but there is no normal code execution. In fact when we tested session variables they also disappear.
We have attempted to change the cache timeout to 5 seconds and within the 5 seconds we can click the search button 3 times in quick succession in one second intervals and it works and on the fourth time the page is broken as above etc. Also tried doing a search and waiting until the 5 seconds are up and then trying the search and get a broken page.
We have changed the cache to 60 and within the the 60 seconds we only get a broken page no matter how many times we press the search button.
Hence as described before the results are unpredictable.
We would love to be able to turn caching off but we're not sure if there is such an option?
Cheers
Should also mention the checkbox list is being reset to default values when the page breaks.
Try using a tool like LiveHTTPHeaders for Firefox to make sure the requests are being made from your browser. Also, check your IIS log file to check the request is getting to the server.
You can also add your controls directly on to the templateand not through a macro, this will remove any macro caching Umbraco is performing.
Chris
Hi Chris,
We have already tried adding the user controls directly to the template. I think that there is also template caching because the same thing happens.
Running the code directly from IIS is ok though.
All of our companys code is experiencing the same problem not just this one that I am working on. :(
I also read about how macro caching works and watched the 4 videos that are provided on macro caching.
I tried setting public properties and all that.
But really when I click on the page and then try a postback with cache timeout set to 0. None of the code behind will execute because a new page is loading. If cache set to > 0 then postback goes to the cached page.
We are using umbraco 4.0.2.1 and I have asked if we can set up the beta here in case anything is fixed
But the only thing I can assume at present is that Umbraco does not like dynamic pages that postback and would prefer to cache pages correctly only if they are visited from another page and have macro parameters/values set in the query string.
Correction:
But really when I click on the page and then try a postback with cache timeout set to 0. None of the code behind will execute because a new page is loading. If cache set to > 0 then postback goes to initial cached page not the correct page.
Yep, I think you've exhausted my knowledge on this one... Does anyone else have more ideas?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.