Monday, February 4, 2008

Message: Cannot open log for source 'ExceptionManagerInternalException'. You may not have write access.

Message: Cannot open log for source 'ExceptionManagerInternalException'. You may not have write access.

Came across this message when trying to write to the event log using Microsoft.ApplicationBlocks.ExceptionManagement.dll in the Infopath (IFS) form codebehind. However, if you are an administrator of the box (web server where this is running on), you won't have a problem writing to the event log. Since we cannot grant all users administrator rights, that option is out.

Solution: by default, a sharepoint site uses impersonation. Use the SPSecurity class:

SPSecurity.RunWithElevatedPrivileges(delegate()
{
ExceptionManager.Publish(ex);

});

As a side note, do not mess with the existing settings in web.config of the sharepoint site. Taking out impersonate="true" messed up our BDC and other things....

Infopath Submit Error

Came across this error today while trying to use ExceptionManager to write to the eventlog:
Message: The form cannot be submitted to the following location: http://d7014yleimoss:2007/Investments/10118.xml. There is a problem with the Web server. Make sure the Web server exists, try again later or contact the Web server administrator.

Happily this didn't take me time to figure out.

Solution: The user role was created to be able to submit the form, BUT the user was not granted 'contribute' access to to the Forms Library 'Investments'. Grant the logon user the 'contribute' access in the Forms Library Settings and the form submitted successfully.