I noticed that google must index your webpage before displaying contextual ads, otherwise it chooses keywords from the file name. Is that true?
No. The adsense system has their own bot that visits your site and determines what ads are to be displayed. It has nothing to do with being indexed by Google. The Adsense bot does take filenames into account though, and you can wait anything from a few minutes to a few hours or days for relevant ads to start showing.
Whenever I put up a new page I visit it and Refresh a few times until relevant ads are displayed. That usually works.
Crusader is right. My logs show the regular "google bot" versus "media partners googlebot which I believe is the Adsense bot.
alright, thanks... i refreshed the page for about 10 times and it worked. what's weired is that the ads stop being targeted even if you changed an already indexed page.
Google does indeed crawl your page the first time you place the AdSense code on it, but it's a different crawler that visits. Until the page is crawled, however, ads are chosen based on what it knows about the page (the file part of the URL) and the site the page is on (the domain). And yes, the AdSense crawler respects the robots.txt file, so if you exclude it you won't get relevant ads except via munging your URL. (This is what I refer to as an extreme form of section targeting...)