Event not called when run from URL

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
 
S

Scott Herter

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.
 
S

Scott Herter

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.
 
»

»OÆW·L³n§Þ³N¤ä´©³¡

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."
 

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