We have found that when you add the WebUrl parameter to a data view – or the SPDataSource to be more exact (see below) to show the contents of a list from a different web to the current one:
<WebPartPages:DataFormParameter Name="WebURL" ParameterKey="WebURL" PropertyName="ParameterValues" DefaultValue="<your-web-url>"/>
and refresh the page in your browser, then you find these hideous messages in your SharePoint logs that look similar to this:
“An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it. This object will now be disposed. Allocation Id: {42A8CB1F-D1B6-41FA-9E2A-B1D64B4F5ADA} To determine where this object was allocated, create a registry key at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\HeapSettings. Then create a new DWORD named SPRequestStackTrace with the value 1 under this key.”
Steps to Reproduce:
(I assume that you have experience setting up data views)
STEPS TO REPRODUCE:
SETUP
1. Create 2 webs in a site collection from a Team site template (this will create the announcements list). For example
http://yourserver/sites/products/remote
and
http://yourserver/sites/products/local
2. Open SharePoint Designer (SPD) and open the web in /sites/products/local.
3. Add a data view web part to this page and point to the out of the box announcements list (in the local web)
4. Save the page and go to the browser to view the results.
5. Inspect your sharepoint log and you should NOT see any of the above error messages
CHANGE THE ListName
1. Still in SPD in the local site. Go change the definition of your data view to point to the list name rather than to the ListID (this is important for the next step)
2. Find the the <selectParameters> node in the code window in SPD and change the parameter for ListID to ListName and the guid of the List to the Name of the list
your web part definition should look like this (the bits that have changed are highlighted):
<SharePoint:SPDataSource runat="server" DataSourceMode="List" UseInternalName="true" selectcommand="<View></View>" id="dataformwebpart2">
<SelectParameters>
<WebPartPages:DataFormParameter Name="ListName" ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Announcements"/> </SelectParameters>
2. Save and refresh your browser page
3. inspect your log and it should still NOT have the above error message.
POINT TO THE WEBURL
1. Still in SPD in the local site. Add a new DataFormParameter to point to the 'remote' site.
2. Add a new node to the <SelectParameters> xml node
<WebPartPages:DataFormParameter Name="WebURL" ParameterKey="WebURL" PropertyName="ParameterValues" DefaultValue="/sites/products/remote"/>
3. your web part definition should look like this (the new node is highlighted)
<WebPartPages:DataFormParameter Name="ListName" ParameterKey="ListName" PropertyName="ParameterValues" DefaultValue="Announcements"/></SelectParameters>
3. inspect your log and you will see the memory leak message.
(I think the SPDataSource component is opening an SPWeb or SPSite object and it is not being disposed correctly when the connection is closed. This is a common error/issue with .net applications.)
We are looking at alternatives right now as this is causing issues with an intranet, specially since these web parts are in the master page so every page request causes this issue. Will keep you posted.