Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

How to: Preview and Debug Form Templates that Require Full Trust

By default, if you attempt to debug or preview a managed-code project that contains code that invokes an object model member that requires full trust, such as the LoginName property which requires access to information about the user's login domain, Microsoft InfoPath will display the following error messages.

When previewing:

"An unhandled exception has occurred in the form's code." Followed by, "InfoPath cannot complete this action, because of an error in the form's code."

When debugging:

Focus will move to the line of code in the code editor that is calling the member that requires full trust, and the following message will be displayed: "SecurityException was unhandled by user code - Request failed".

To allow the form template's business logic to call this member when it is being debugged or previewed, you must set your form template's security level to Full Trust as described in the following procedure.

Set your form's security level to Full Trust

  1. In InfoPath, open the form template in design mode.

  2. Click the File tab, and then click Form Options on the Info tab.

  3. In the Category list, click Security and Trust.

  4. Under Security Level, clear Automatically determine security level.

  5. Select Full Trust, and then click OK.

After this procedure is performed, you can debug your project as described in How to: Preview and Debug InfoPath Form Templates with Code.

Note Note

Successfully deploying a managed code form template that requires full trust requires additional steps, such as digitally signing, or installing and registering the form template. For information on deploying a managed code form template after it is debugged see, How to: Deploy InfoPath Form Templates with Code.

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.