Content Query Web Part with Forms Authentication / Anonymous Access
Many would agree with me that Content Query Web Part (CQWP) is a very useful and smart Web part. It gives you the power to show the requested data with the requested look and feel.
I used CQWP a lot only with Windows Authentication for intranet purpose. But i had some problems with it when deploying websites using Forms authentication or Anonymous Access.
After logging in with your forms credentials you will get the following error message from CQWP:
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Windows SharePoint Services-compatible HTML editor such as Microsoft Office SharePoint Designer. If the problem persists, contact your Web server administrator.
By default, CQWP uses ItemStyle.xsl file which lies under ~/Style Library/XSL Style Sheets/ library.
My workaround was to do the following:
- I tok a copy of my modified ItemStyle.xsl and put it inside a library that users have read access to.
- Then I created a simple version of CQWP that looks like this:
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Title" type="string">Simple CQWP</property>
<property name="Description" type="string">CQWP with customized ItemStyle.xsl path</property>
<property name="ItemXslLink" type="string">/Documents/ItemStyle.xsl</property>
</properties>
</data>
</webPart>
</webParts>
- Then I imported the .webpart file to the WebPart Gallary.
Hope this helps