Anonymous access and the Content by Query Web Part (CQWP): Fixing CopyUtil.aspx

by 11. July 2008 00:27

As we all know, the CopyUtil class which provides the link functionality for the CQWP does not override the AllowAnonymousAccess property of the UnsecuredLayoutsPageBase class. This results in anonymous users being prompted to login when they click on any links generated by the CQWP. A common method of getting around this is to strip out the GUID of the item, and hard-code a link to the display form (here is how to do this). This works great if your CQWP is querying only one list, but it does not work at all if you are querying multiple lists throughout your site collection.

If you are querying multiple lists, the only workaround is to write a custom class which inherits from CopyUtil. Here are the steps you can follow to get this working:

  1. Log in to your MOSS Web front end server, and navigate to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS
  2. Rename CopyUtil.aspx to CopyUtil_.aspx (Alternatively: If you don't want to modify any SharePoint files you can rename the CopyUtil.aspx which comes with this post, but be sure to update your ItemStyle.xsl to point to the new name)
  3. Download CopyUtil.zip below, it comes with two files: CopyUtil.aspx and CopyUtil.aspx.cs, unzip these files into the LAYOUTS folder:

That's it, and don't forget to disable the ViewFormPagesLockDown feature if you are running a publishing portal.

CopyUtil.zip (887.00 bytes)

Tags: , ,

Comments are closed

About the author

Something about the author

Month List