Cannot open log for source ‘Custom_Web_Part’. You may not have write access
In a SharePoint site, When I logged in as an administrator, all pages accessed successfully. But as a regular user it scolded me with Access denied Error 🙂
Enabled the stack trace and Turned off custom error message page to get the actual error.
Error detail: System.ComponentModel.Win32Exception: Access is denied. Below it, in the stack trace, another exception popped: InvalidOperationException: Cannot open log for source ‘My_Web_Part’. You may not have write access.
Solution:
This is because non-administrators do not have permission to write on the event log. So for this problem, just grant non-administrator users permission to write on the event log.
- Open registry editor by typing “Regedit” in the run box.
- Navigate to: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Eventlog\Application
- Look for CustomSD, it should contain string:
O:BAG:SYD:(D;;0xf0007;;;AN)(D;;0xf0007;;;BG)(A;;0xf0007;;;SY)(A;;0x7;;;BA) (A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)The string is formatted as an SDDL, you can find more information about the format at Microsoft’s site.
- Now change the value to give the event log’s read-write permission to all authenticated users. To do this, append the string (A;;0x3;;;AU) to the entry CustomSD, So it becomes:
O:BAG:SYD:(D;;0xf0007;;;AN)(D;;0xf0007;;;BG)(A;;0xf0007;;;SY)(A;;0x7;;;BA) (A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)(A;;0x3;;;AU)
It’s a best practice to backup registry before you do any change.
Everything is very open with a clear description of
the issues. It was definitely informative. Your website is
useful. Thanks for sharing!