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.  

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.

  1. Open registry editor by typing “Regedit” in the run box.
  2. Navigate to: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Eventlog\Application
  3. 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.

  4. 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.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

One thought on “Cannot open log for source ‘Custom_Web_Part’. You may not have write access

  • Everything is very open with a clear description of
    the issues. It was definitely informative. Your website is
    useful. Thanks for sharing!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *