SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on custom authentication for SharePoint 2010. And I found very useful to use SharePoint Logger from MS P&P SharePoint 2010 Guidance Library.

It works fine when I get instance of SharePointLogger through SharePointServiceLocator only when user is already authenticated under web application and have read privileges on top level site collection. But when I try to instantiate it in ASP.NET page code-behind before user authenticate (it's a custom multilogon authentication provider selecting page) I get different errors:

1) if I use SharePointServiceLocator - I get in logs "Unknown SPRequest error occurred. More information: 0x80070005" and 403 error in browser.

2) if I run SharePointServiceLocator code under SPSecurity.RunWithElevatedPrivileges I get exception in browser with stack trace, which says that ServiceLocator tried to access property bags but hasn't privileges.

3) if I use directly "new SharePointLogger()" - I get 403 in browser and nothing significant in logs.

So I decide that it's hard to use P&P SharePointLogger in this specific case. But please let me know if you have a suitable solution for this case or alternate logging approach.

Thanks in advance.

share|improve this question

If you are trying to write to ULS, can you try this code (preferably SPRunWithElevatedPrivileges) -

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.