Security Exception Error - InfoPath Dev
in

InfoPath Dev

Security Exception Error

Last post 02-27-2008 04:59 PM by wildguixe. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-21-2008 03:45 AM

    Security Exception Error

    Hi - I am using Infopath 2007 and VB.

    I have a form with several bits of code behind the Changed/Changing events.  The form's permissions are set to automatically determine level required.

    I have started getting errors when running code.....

    Dim grp As String = "/my:ApplicationGroup/my:ApplicationContactsGroup/my:InvistaITContactGroup"
    Dim
    concat As String = ""
    Dim itgroup As XPathNodeIterator
    Dim navout As XPathNavigator
    itgroup =
    Me.CreateNavigator.Select(grp, NamespaceManager)
    Dim norecs As Integer = itgroup.Count
    <-------- at this point I get the error

    System.Security.SecurityException was unhandled by user code
      Message="Request failed."
      Source="Microsoft.Office.InfoPath.Client.Internal.Host"
      StackTrace:
           at Microsoft.Office.InfoPath.MsxmlNavigator.IsValidNode(MsxmlNode test)
           at Microsoft.Office.InfoPath.MsxmlNavigator.MoveToFirstChild()
           at MS.Internal.Xml.XPath.XPathChildIterator.MoveNext()
           at MS.Internal.Xml.XPath.ChildrenQuery.Advance()
           at MS.Internal.Xml.XPath.ChildrenQuery.Advance()
           at MS.Internal.Xml.XPath.ChildrenQuery.Advance()
           at MS.Internal.Xml.XPath.Query.MoveNext()
           at MS.Internal.Xml.XPath.Query.get_Count()
           at MS.Internal.Xml.XPath.XPathSelectionIterator.get_Count()
           at ApplicationIndex10.FormCode.Concatenate_Multiple_owner_fields(String grp, String fld1, String fld2, String fld3, String fld4, String punc, String concatfield)
           at ApplicationIndex10.FormCode.InvistaITContactGroup_Changed(Object sender, XmlEventArgs e)
           at Microsoft.Office.InfoPath.Internal.XmlEventHost.GenericProxy(Object genericDelegate, DataDOMEvent dataDOMEvent, InfoPathEvents type)
           at Microsoft.Office.InfoPath.Internal.XmlEventHost.ChangedProxy(DataDOMEvent dataDOMEvent)
           at Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_SinkHelper.OnAfterChange(DataDOMEvent pDataDOMEvent)

     

    When I am running in debug mode and have had the exception I go into 'enable edit', and re-run exactly the same lines of code and it works ........ so can't get to the bottom of the problem.

    I don't understand why accessing a group in my main data source would give this error -  and why it doesn't run in debug - but once it has had the error and I run the same lines again it works - can anyone explain where I have gone wrong..... 

    This is happening in several places in the code.  The consistent thing is that it is always on a .count of a navigator where the problem occurs.

    Thank you.

    Catharine

  • 02-25-2008 04:59 PM In reply to

    Re: Security Exception Error

    In the Changing event handler, the DOM is readonly.

    In the Changed event handler, be sure to examine the e.Operation property to only process your code during the right operation (i.e. Delete, Insert, Value Change, etc)

  • 02-26-2008 01:51 AM In reply to

    Re: Security Exception Error

    Hi,  I have fallen foul of that before.....

    But I have double checked - in this case it is in a Changed event.   When run stepwise in debug,  I get the error message, then when repeating the line of code it works ?  Very odd. 

    Why would I need any extra permissions for accesssing data from my main data source which is within the form ?

    Catharine 

     

  • 02-26-2008 03:08 PM In reply to

    Re: Security Exception Error

    That it is giving you a security error is what doesn't make sense.

    Please also check that the object you are trying to get .Count on is valid and not null. This shouldn't give you a security error... but I'm at a loss for what could be going on. Doesn't appear that there would be any timing issues or anything.

  • 02-27-2008 04:59 PM In reply to

    Re: Security Exception Error

    try with the framework configuration on the control panel ;) put Full Trust ....

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.