0

i'm working on a SharePoint 2013 site, i have 2 type of registration: (Win Authentication and FBA).
I'm trying to use a solution (WSP) from the old portal (SP 2010), this WSP use a dll named 'Microsoft.Practices.EnterpriseLibrary.Data' which isn't existed in SP 2013 environment.

So to resolve that i installed the Microsoft Enterprise Library 5.0 from Microsoft, then i copied this dll to the bin folder under inetpub\wwwroot\wss\VirtualDirectories\80\

Now when i logged in to site using windows authentication mode the WebPart appear but when logged as FBA User the an error appeared:

System.InvalidOperationException: Cannot open log for source 'Microsoft.Practices.EnterpriseLibrary.Data'. You may not have write access. ---> System.ComponentModel.Win32Exception: Access is denied
   --- End of inner exception stack trace ---
   at System.Diagnostics.EventLogInternal.OpenForWrite(String currentMachineName)
   at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName)
   at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type)
   at ProjectName.Internet.EventViewerLogService.LogEvent(String source, String message, EventLogEntryType type)
   at ProjectName.Internet.ExceptionHandler.Handle(Exception exception)
   at ProjectName.Internet.SQLHelper.GetVolunteerInfo(String VolunteerId)
   at ProjectName.Internet.Profiles.Volunteer.GetVolunteer(String VolunteerId)
   at ProjectName.Internet.Accessibility.Accessibility.AccessibilityUserControl.Page_Load(Object sender, EventArgs e)


Note: i tried to give permission to "Security" into the registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security to the 'Authenticated Users group' because i had an error in the beginning Error: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

PS: This is a follow up to this . I followed the given answers but to no avail.

I guess this is due to some configuration issue on server?

Samer
  • 150
  • 5
  • 17

1 Answers1

2

The error is related to permission issue, when i logged in with FBA User i missed the permission to write into new event Sources.

By default, any authenticated user is able to write to application event log. However only administrators can create new event Sources.

I resolve it by run the CreateEventSource method with elevated Privileges, like the below:

SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                if (!EventLog.SourceExists(eSource))
                {
                    EventLog.CreateEventSource(eSource, eLog);
                }
                EventLog.WriteEntry(eSource, ex.ToString(), EventLogEntryType.Error);
            });
Samer
  • 150
  • 5
  • 17