Microsoft KB Archive/305998

= BUG: ADO Record.GetChildren Returns Cached Data for Web Site =

Article ID: 305998

Article Last Modified on 12/15/2003

-

APPLIES TO


 * Microsoft OLE DB Provider for Internet Publishing 1.5
 * Microsoft OLE DB Provider for Internet Publishing 2.0

-



This article was previously published under Q305998



SYMPTOMS
When you use ActiveX Data Objects (ADO) and the OLEDB Provider for Internet Publishing (MSDAIPP) to get the contents of a Web site that is running FrontPage Server Extensions (FPSE), the Record.GetChildren method may return a recordset that contains cached data from the Web site, and may not contain recent changes that are made by other users who were connected to the same Web folder.

This problem usually occurs after you install Microsoft Office XP or Microsoft FrontPage 2002.



CAUSE
MSDAIPP connects to Web sites that are running FPSE by using the Web Extender Client (WEC) and its associated protocols. Because of a recent change to WEC version 5.0 (which ships with Office XP and FrontPage 2002), clients that do not explicitly request a refresh from the server may be given cached data that was retrieved previously during the same session. This change is an optimization to improve overall performance; however, one result is that ADO clients that use MSDAIPP and WEC can no longer assume that Record.GetChildren returns the most current information on the server.



RESOLUTION
To work around this problem, do either of the following:
 * On the server: Change the Web folder that is being accessed to a virtual folder in IIS Manager. MSDAIPP makes a Distributed Authoring and Versioning (DAV) request to the virtual folder to see if any recent changes have been made, and, if so, does a full refresh when GetChildren is called. If the folder is not a virtual folder, the DAV request fails and MSDAIPP allows WEC to determine if a full refresh is needed. WEC 5.0 does not make this check automatically. -or-


 * On the client: Move the code that calls the GetChildren property into an ActiveX EXE. Each time you want to do a full refresh, create a new instance of the ActiveX EXE object, which in turn starts a new WEC session in a new process. This causes WEC to do a full update for that session.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
To run this sample code, you need to have the URL to a Web folder that was created by FrontPage (or another WEC client). Note that if the folder is also a virtual folder according to IIS, the problem does not occur.

To set up a server, follow these steps:
 * 1) Use FrontPage 2002 to create a new Web site. As the location for the site, specify a URL to a server on which you have Edit permissions.
 * 2) Add a few stock pages to the Web site (content itself doesn't matter).
 * 3) On the server, find the new Web site's folder under the location of the Wwwroot folder, and open a File Explorer window to make manual changes. (You may choose to share out the folder and open it by using the UNC path to make it easier to work with.)

After this is done, you can build a client that gets the folder contents by using MSDAIPP. To do this, follow these steps:  Start Microsoft Visual Basic 6.0 and create a Standard EXE project. Form1 is created by default. On the Project menu, click References, and add a reference to Microsoft ActiveX Data Objects 2.5 (or later) Library. Add a command button, a list box, and text box to Form1. Accept all the default names (that is, Command1, List1, and Text1).  In the code window for Form1, paste the following code: Option Explicit

Private Sub Command1_Click Dim oRec As ADODB.Record Dim oRS As ADODB.Recordset

' Open a new record based on the URL (using MSDAIPP provider). Set oRec = New ADODB.Record oRec.Open &quot;&quot;, &quot;URL=&quot; & Text1.Text, adModeRead, adFailIfNotExists ' If the URL is correct, get a recordset with a ' listing of all the files at that location. Set oRS = oRec.GetChildren ' Output the names. List1.Clear Do While Not oRS.EOF List1.AddItem oRS(0) oRS.MoveNext Loop Set oRS = Nothing

' Close the record (and connection). oRec.Close Set oRec = Nothing

End Sub  Press F5 to run the program. Type the full URL to your Web folder in the text box, then click Command1. A list of files appears in the list box.</li> On the server (or from the UNC window), add new files to or remove existing files from the folder.</li> Click Command1 again. Note that the list remains the same despite your recent changes.</li></ol>

Keywords: kbbug kbpending KB305998

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.