<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Open more than one FormControl with unsigned templates</title><link>https://www.infopathdev.com:443/forums/thread/60484.aspx</link><pubDate>Tue, 19 Oct 2010 14:31:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:60484</guid><dc:creator>jwooley</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/60484.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=60484</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m seeing a similar problem when trying to access either form&amp;#39;s MainDataSource.CreateNavigator&amp;nbsp;after opening two up. How were you able to resolve your issue?&lt;/p&gt;</description></item><item><title>Open more than one FormControl with unsigned templates</title><link>https://www.infopathdev.com:443/forums/thread/47952.aspx</link><pubDate>Fri, 16 Oct 2009 12:52:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47952</guid><dc:creator>rsteenbergen</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47952.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=47952</wfw:commentRss><description>&lt;p&gt;Hi all, &lt;/p&gt;
&lt;p&gt;&amp;nbsp;I have a very specific situation:&lt;/p&gt;
&lt;p&gt;- Tabbed WPF application where each tab can contain a view with an Infopath FormControl. When a tab is opened, it creates a FormControl and does NewFromTemplate with the specified infopath template location. &lt;br /&gt;- Unsigned infopath document templates that are only used to collect data. On submit, the data is stored in a business entity and saved to the database. The application works fine when one tab is opened. &lt;/p&gt;
&lt;p&gt;The problems start when I open a second tab, return to my original tab and try to do anything programmatically with the XmlForm. (like checking the IsDirty property) &lt;br /&gt;&lt;br /&gt;After a while of debugging I found that the following debug &amp;quot;watch&amp;quot; changes each time a new Tab (and thus FormControl) is opened: &lt;br /&gt;((Microsoft.Office.Interop.InfoPath.XDocumentClass)(Microsoft.Office.Interop.InfoPath.SemiTrust.InfoPathOMHelper.thisDoc))._XDocument3_URI &lt;br /&gt;&lt;br /&gt;With the first tab it&amp;#39;s &amp;quot;Form 1&amp;quot;, when opening the second tab this jumps to &amp;quot;Form 2&amp;quot; It appears that the SemiTrust provider for infopath holds a reference to a &amp;quot;current&amp;quot; document and if you try to access the XmlForm of the FormControl that&amp;#39;s not the current document, you get SecurityExceptions (see below) &lt;br /&gt;&lt;br /&gt;Does anybody know what can be done about this? &lt;/p&gt;
&lt;p&gt;- Somehow tell the infopath host which document is currently selected (I couldn&amp;#39;t find anything like this in the documentation / samples) &lt;br /&gt;- Use different infopath hosts (is that even possible) for each tab &lt;/p&gt;
&lt;p&gt;The exception: &lt;br /&gt;System.UnauthorizedAccessException was unhandled by user code&lt;br /&gt;&amp;nbsp; Message=&amp;quot;Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))&amp;quot;&lt;br /&gt;&amp;nbsp; Source=&amp;quot;Microsoft.Office.InfoPath.Client.Internal.Host&amp;quot;&lt;br /&gt;&amp;nbsp; StackTrace:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust.ICLRExtensions.IsCrossDomainSafe(Object punkCallee)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust.InfoPathWrapperHelper.CheckCrossDomainSafety(IServiceProvider serviceProviderCallee)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust.XDocumentWrapper.get_IsDirty()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.InfoPath.Internal.XmlFormHost.get_Dirty()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Bdo.AuditTool.Main.v1.Controls.InfoPathViewerControl.FormEvents_ContextChanged(Object sender, ContextChangedEventArgs e) in C:\Qurius\Sources\BDO - Audit Tool\Source\VS.NET\Bdo.AuditTool\Bdo.AuditTool.Main.v1\Controls\InfoPathViewerControl.xaml.cs:line 314&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.InfoPath.Internal.FormEventsHost.OnContextChange(DocContextChangeEvent pEvent)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_SinkHelper.OnContextChange(DocContextChangeEvent pEvent)&lt;br /&gt;&amp;nbsp; InnerException: &lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>