Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Problem registering for events from WinForms control hosted in IE

Reply
Thread Tools

Problem registering for events from WinForms control hosted in IE

 
 
Mike
Guest
Posts: n/a
 
      01-16-2009
I've had a WinForms control hosted in IE for quite some time now and
it has always worked well (.NET 2.0, IE 7). But recently as we are
preparing for a new release my script tags (e.g. <script for=> that
register for the controls events no longer seem to work. I've never
had a problem with this before and none of the code related to this
has changed since the last release. So when my events fire, there are
no subscribers and nothing happens. Here is a stripped down version of
what I am doing:

[Guid("4DC1846A-197B-48fe-880A-AB59DB5C1226")]
[ComVisible(true)]
[InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)]
public interface IMyEvents
{
[DispId(0x60020002)]
void EventOne(string arg1, string arg2);
}


[ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces(typeof(IMyEvents))]
public partial class MyClass : UserControl
{
public delegate void EventOneDelegate(string arg1, string
arg2);


[Browsable(true)]
public event EventOneDelegate EventOne;

private MyInternalFunc()
{
// this is always "null"
if (EventOne != null)
EventOne("hello", "world");
}

// etc


Finally the HTML and script tag:

<object id="myControl" classid="MyAssembly.dll#MyClass">
<param name ="Param1" value ="foo" />
<param name ="Param2" value ="bar" />
</object>

<script for="myControl" event="EventOne(string arg1, string
arg2)">
alert('Hooray!');
</script>

Here is my IE setup:

The assembly is signed
page is in Trusted Sites Zone
in .NET 2.0 config, Trusted Sites has "Full Trust" permissions (I had
less permissions before, but I ramped them up to try to root out the
issue)
"Download signed activeX controls" - Enable
"Initialize and Script controls not marked safe for scripting" -
Enabled
"Run ActiveX controls and plugins" - Enabled
"Script ActiveX controls marked safe for scripting" - Enabled
There are no javascript errors on the page when it is loaded
I'm a bit stumped on why the script tag is not registering for the
event. Again, this has worked flawlessly for a while now.
"What changed?" you ask? The only thing I can tell is that the
assembly with my control has more classes in it now, and the assembly
is now marked as "ComVisible" in AssemblyInfo.cs, whereas it was not
before. I have changed ComVisible to no avail.

There is precisous little info on the net for this particular problem,
especially since the control loads and runs fine, minus the events
issue.

Help appreciated
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: registering/re-registering ASP.NET 1.1.4322 with IIS Juan T. Llibre ASP .Net 2 12-16-2006 12:29 AM
Problem with WinForms User Control Hosted in IE =?Utf-8?B?U2VnZmFobHQ=?= ASP .Net 5 01-13-2006 09:51 AM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
Registering clientside events for a RadioButtonList Helen ASP .Net 2 09-30-2004 08:21 PM
registering events for dynamically declared DataGrids Faredoon Irani via .NET 247 ASP .Net Web Controls 0 08-05-2004 09:39 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57