Security Error in OnContextChange Event

M

Michelle

X-No-archive: yes

I am trying to copy the context sensitive help example described at
http://blogs.msdn.com/philoj/archive/2004/04/25/119926.aspx

The Infopath form uses SP1 and C# and is published to a Sharepoint
Form Library. It runs fine on my computer. However, as soon as I try
to open the Infopath form from a colleague's computer I get the
following error:

Security Error
at mySolution.OnContextChange(DocContextChangeEvent e)
at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2
_SinkHelper.OnContextChange(DocContextChangeEvent pEvent)

Needless to say this error is not very helpful.

What I have found is that when you look at the properties available
for thisXDocument.View.Window.TaskPanes you get Visible and
TaskPaneType. What the example does is cast the TaskPanes item
(TaskPanes[0]) to HTMLTaskPaneObject which should make properties like
HTMLDocument and readyState available. As soon as I try to access
these properties that are not available without the cast I get the
security error.

At this point I'm thinking the problem lies with something not being
installed on my colleague's computer. He has InfoPath SP1 and Visual
Studio .NET installed.

Any help would truly be appreciated.

Assuming this can be resolved, the next step would be to figure out
what needs to be installed on client machines at a minimum in order to
get the InfoPath forms to work without these security errors being
bubbled up. If someone could clearly specify those minimum
requirements that too would be appreciated.

Many thanks!
 
J

Josh Bertsch [MSFT]

Is the form fully trusted?

In order for onContextChange to work properly on each machine, the machine
needs to have MSHTML.dll PIA registered in the GAC.

So, make sure the latest MSHTML.dll PIA is installed in the GAC and run
"gacutil -i Microsoft.mshtml.dll" and "regasm.exe Microsoft.mshtml.dll".

That should do the trick!

--josh bertsch
 
M

Michelle

Thanks for your quick response Josh.

The form is not fully trusted. Our intent was to distribute the form
through a Sharepoint Forms library.

I went ahead and ran gacutil and regasm on the Microsoft.mshtml.dll,
but it had no effect. Tried this on three different machines.
They're still getting the same error.

Is there something else that might be missing?

Regards.

Josh Bertsch said:
Is the form fully trusted?

In order for onContextChange to work properly on each machine, the machine
needs to have MSHTML.dll PIA registered in the GAC.

So, make sure the latest MSHTML.dll PIA is installed in the GAC and run
"gacutil -i Microsoft.mshtml.dll" and "regasm.exe Microsoft.mshtml.dll".

That should do the trick!

--josh bertsch


Michelle said:
I am trying to copy the context sensitive help example described at
http://blogs.msdn.com/philoj/archive/2004/04/25/119926.aspx

The Infopath form uses SP1 and C# and is published to a Sharepoint
Form Library. It runs fine on my computer. However, as soon as I try
to open the Infopath form from a colleague's computer I get the
following error:

Security Error
at mySolution.OnContextChange(DocContextChangeEvent e)
at Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2
_SinkHelper.OnContextChange(DocContextChangeEvent pEvent)

Needless to say this error is not very helpful.

What I have found is that when you look at the properties available
for thisXDocument.View.Window.TaskPanes you get Visible and
TaskPaneType. What the example does is cast the TaskPanes item
(TaskPanes[0]) to HTMLTaskPaneObject which should make properties like
HTMLDocument and readyState available. As soon as I try to access
these properties that are not available without the cast I get the
security error.

At this point I'm thinking the problem lies with something not being
installed on my colleague's computer. He has InfoPath SP1 and Visual
Studio .NET installed.

Any help would truly be appreciated.

Assuming this can be resolved, the next step would be to figure out
what needs to be installed on client machines at a minimum in order to
get the InfoPath forms to work without these security errors being
bubbled up. If someone could clearly specify those minimum
requirements that too would be appreciated.

Many thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top