Sometimes when trying to access an InfoPath form deployed to a web site you will get a cryptic security error preventing the form from opening. This can happen both for intranet or internet web sites and is oftentimes due to the fact that the form has C# code in it. This can happen even if the C# InfoPath project is empty. Most of the time you will see a dialog like this:

Initially you should do the following to eliminate some typical causes for this:
- Clear your Internet Explorer cache by selecting Options from the Tools menu. This is to work around a bug in Internet Explorer.
- Delete any existing copy of the form that has been cached by InfoPath. To do this open InfoPath and in the "Fill Out a Form" dialog select the form to delete and click "Remove this form" in the right list of commands.
- Finally close all instances of InfoPath and Internet Explorer and then try to reopen the form.
- As a last resort reboot your machine to ensure that IE and InfoPath are really shut down when retrying.
If this does not solve the problem then you can try adding the web site to your Local Intranet zone in Internet Explorer.
Note: Be careful to only add sites which you trust to the Local Intranet zone. This zone grants greater privileges to included web pages and forms.
Note: Managed code runs with reduced security when a site is added to the Trusted Sites zone. Yes this is counter-intuitive but that's how it works. So don't get confused and add a site to your Trusted Sites zone.
To add the site to the Local Intranet zone in Internet Explorer do the following:
- In Internet Explorer select Internet Options from the Tools menu.
- Select the Security tab from that dialog.

- Select "Local intranet" then click the Sites button.
- In that dialog click the "Advanced..." button. You will get this dialog.

- In the text box at the top enter the name of the server you are trying to access. For example enter http://myintranetsite/ or http://www.example.com.
- Click the Add button.
- Click Close on this dialog.
- Click OK on the previous dialog.
- Click OK on the Internet Options dialog.
- Try opening the form again. Note: You may need to close all instances of Internet Explorer and InfoPath first for the change to take effect.