Thursday, April 3, 2008

Tip! SharePoint Search in combination with anonymous users

Have you already noticed that every time an unauthenticated user tries to search, a user prompt shows up? Well this is due to the fact that the OSSSearchResults.aspx has an inheritance reference to "Microsoft.SharePoint.WebControls.LayoutsPageBase". This inheritance isn't necessary to work properly. So... What you can do is just removing the whole line in the page directive "Inhertis=...." and save it. Don't forget to make a copy of the file!

Note - On MSDN you can read:

In general, use LayoutsPageBase as a base class for pages that should only be accessible to authenticated users with certain rights. For pages to which even
unauthenticated users should have access, use the parent class UnsecuredLayoutsPageBase.


I have tried to switch to this base class, but it didn't work for me. Anyone who did it?

2 comments:

Rich Finn said...

Hi Sven,

If this doesn't work, you can inherit from Page. You don't get all the helpful overrides, but it'll get the job done.

-Rich Finn

Paul Stork said...

UnsecuredLayoutsPageBase is flagged as an abstract class in SharePoint 2007. You'll need to create a class of your own that inherits from UnsecuredLayoutsPageBase. Then use that class to inherit your page from. I've tried this and it works.

Paul Stork, SharePoint Server MVP