Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

1 Answer 1

If you are trying to write to ULS, can you try this code (preferably SPRunWithElevatedPrivileges) - http://www.chakkaradeep.com/post/SharePoint-2010-Log-to-ULS-from-code.aspx

share|improve this answer

Your Answer

 
discard

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.