InfoPath Error – System.Security.SecurityException

By calejo on June 30th, 2011



I’ve made a simple InfoPath form, and in “Submit Options”, checked  “Perform custom action using Code”, and write some custom code…

Then i run the debug over this code. The InfoPath formular opened in preview mode, and i could successfully step through InternalStartup method.

I did put some data in fields and clicked on “Submit” button. I expected to be continue debugging at the beging of “FormEvents_Sumbit” method, but i got this error message:

“System.Security.SecurityException
Request for the permission of type ‘Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ failed.
at TEST_FORM2.FormCode.FormEvents_Submit(Object sender, SubmitEventArgs e)
at Microsoft.Office.InfoPath.Internal.FormEventsHost.OnSubmit(DocReturnEvent pEvent)
at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnSubmitRequest(DocReturnEvent pEvent)”

______________________________

Resolution

- Open your form in Info Path Designer and open the FormOptions.

- Click on the “Security and Trust” hyperlink.

- Uncheck “Automatically determine security level”

- Check Full Trust (the form has access to files and settings on the computer)

- Publish your form

…and then test if the problem still occurs.