Feed

GoogleBot, ISA Caching & JavaScript

by Pazcal 24. November 2010 11:36

Ok, this sucks.

Scenario
At this moment we have a 12 live webservers, which provides all our website (.NET) to the great, big, bad world. With a nice ISA cache server between the servers and the www, all websites are fast when a request is made. Every 4 hours our ISA Cache Server will be reset, so new data can be provided for the next 4 hours.

When the ISA cache is reset and a new customer requests our webpage, the page will be set in the ISA cache, with all the functionality which is needed for the website. This includes JavaScript.

Except: When The GoogleBot is the first visitor of a website, which isn’t cached in the ISA server, the website is getting cached without the JavaScript. This will give result of a 4 hour, non JavaScript, ISA cached website which will be exposed to the www.

Solution 1 (at least, we thought)
Lets create a .Browser file in the App_Browser folder, called Form.browser! Inside this file we’ll set:

  <browsers>    
    <browser refID="Default">
        <controlAdapters>
            <adapter controlType="System.Web.UI.HtmlControls.HtmlForm"
                        adapterType="Sellus.Web.FormRewriterControlAdapter" />
        </controlAdapters>
        <capabilities>
             <capability name="ecmascriptversion" value="1.8" />
        </capabilities>
     </browser>
</browsers>

This should be force the EcmaScript to be generated at the form control by default, even if a GoogleBot is visiting the website. The version stands for the browsers which should support JavaScript in a certain way. More info of that on this page here. But again, this is what we thought as the ultimate solution. The result we are getting is: “Sometimes it works, sometimes it doesn’t”. I know, it’s weird. I’m digging into it, and hope to explain the behavior later on…

For now, we are still looking for a good solution for caching javascript, even when a searchbot is passing by…

Update 2010-11-25 (Solution 2 and the fix!)
Great! Thanks to @tronsoft we have found a way to dodge the ISA Cache (even better, any kind of cache mechanism)!

  <%@ OutputCache Location="None" NoStore="true" %>

When adding this 1 piece line of code at the top of your .aspx page, the page won’t be stored at any cache mechanism. Keep in mind, this will only effect the page. The controls which are loading inside the page, have their own OutputCache and will be cached by default. More info about the whole OutputCache can be find here.

Add comment




biuquote
  • Comment
  • Preview
Loading



About the author

Hi. This picture next to this line is me, a.k.a. Pascal de Jonge. I'm currently working as a software engineer @ Tellus, Rotterdam, The Netherlands. Keywords for my work are .NET, C#, WPF, Silverlight, jQuery, CSS and some other random shizzle...

On my own free time, I'm running a small Webdesign/Development Company and playing a lot of games. Reason for this blog is for me to publish several projects like jQuery plugins, Silverlight Apps or WinPhone7 Apps...

Feel free to contact me or just to say 'hi' in several ways, like Twitter, the old fashion contactform or pascal[at]pazquality[.]com.

Widget Twitter not found.

Root element is missing.X

Mostly compatible with

Plugins compatibility

All postings/content on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or sponsors. The content on this site is licensed under a Creative Commons Attribution By license.