Event not called when run from URL

  • Thread starter Thread starter Scott Herter
  • Start date Start date
S

Scott Herter

I created a simple Windows Forms app (strongly named)
in VB .NET that automates MS Word XP. The app handles
the Word.Quit event...however my event handler for this
is not being called when my app is launched from
a url on a web page (works fine when I run my app stand
alone). I have a code group that I created for my app
in order to avoid a security exception when creating the
new Word.Application (I created a code group with the
membership condition tied to the strong name of my app
and set the permission set to "FullTrust").

I originally ran into this problem while trying to do
this with a UserControl embedded in a web page, but
found I could reproduce the behavior with a Windows
Forms App launched from a web page.

So can anyone tell me why the Quit event won't fire when
my app is launched from a url?


Here is the code from my Windows Forms app...


Imports Microsoft.Office.Core
Imports Microsoft.Office.Interop

Public Class Form1
Inherits System.Windows.Forms.Form

' Main member var for getting at Word object model
Private WithEvents m_wordApp As Word.ApplicationClass

Private Sub wordApp_Quit() Handles
m_wordApp.ApplicationEvents2_Event_Quit
m_wordApp = Nothing
MsgBox("Word Quit Event", MsgBoxStyle.SystemModal Or
MsgBoxStyle.Information)
End Sub

Private Sub btnLaunchWord_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnLaunchWord.Click
If m_wordApp Is Nothing Then
m_wordApp = New Word.Application()
m_wordApp.Visible = True
End If
End Sub
End Class
 
I'm bringing up a test page in my browser by
hitting a URL like this...

http://localhost/test/test.html

....and the test page has a link to my app like this:

<a href='WinApp.exe'>WinApp</a>

I originally found the problem while using my sample
code in a UserControl that I embedded in my test page
(ultimately what I need to get working), but since I could
reproduce the behavior with a link to an EXE I thought
it might be easier to trouble shoot that way.
 
Yes, if I change member ship to "all code" it does work, but we
need to limit things to strong name. I just tried to add additional
code groups for the strong names of the Word interop DLLs, but
that didn't help.
 
You may add the server to trusted site on the client side, and set member
ship for "all code" for one code group in "trusted site.

Luke

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026?  If not Microsoft strongly advises
you to review the

information at the following link regarding Microsoft Security Bulletin
MS03-026 http://www.microsoft.com/security/security_bulletins/ms03-026.asp
and/or to

visit Windows Update at http://windowsupdate.microsoft.com to install the
patch. Running the SCAN program from the Windows Update site will help to

insure you are current with all security patches, not just MS03-026."
 
Back
Top