Exposing User Control Properties and Methods to IE

I have created a WinForms UserControl and it loads and displays in IE fine. I'm adding an external interface so that it can be 'driven' by JScript in IE.

<OBJECT id="wvf" height="500" width="800" classid="http:\WvfClient2\WvfCtrl3.dll#WvfCtrlNS.WvfCtrl3" VIEWASTEXT>
<PARAM NAME="DataSourceURI" VALUE="http://localhost/"><param name="PatientID" value="wvfClientNet/TestWav.aspx?PatientID="T104_01_1">
</OBJECT>

So far so good, BUT

The following doesn't work (it's in a function called via a button's onClick)

wvf.GetDataAndGraph();

JScript tells me that it wvf is undefined.
This is a public method of my control. In VS.Net, I don't see any of my controls methods or properties in tool tips when I edit the html.

What's wrong?

Sincerely,
Buzzby.

[893 byte] By [codefund.com] at [2008-2-20]
# 1
does document.all.wvf.GetDataAndGraph(); work?
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 2
Thanks, that helped, but now I've run into the following:

When I hit document.all.wvf.GetDataAndGraph();
I get the following error popup:

mscorlib: Request for the permission of type System.Security.Permissions.ReflectionPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

I'm confused. Wouldn't the control already have used reflection to set the parameters?

Sincerely,
Buzzby

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 3
Well, something in your code must be asking to use Reflection and by default, I guess that's not allowed
codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 4

For future reference - here are some things I've cleared up:

- Originally the object tag was within a <FORM> - and I forgot that in that case I'd need more 'path' information to access it. I moved it out of the form and found I could address it simply with the object name.

- I totally broke the downloading of the control through the .Net Framework configuration tool.
I tried to set it such that since this was coming in from a trusted site, it had full control - ideally enabling reflection. But, somehow I broke it and it wouldn't download the control to the client at all.

I fixed this by resetting the security settings to the defaults. I have a feeling I'll be using that command more in the future.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 5
To view the permissions a zone has go to...

.NET Framwork Configuration->Runtime Security Policy->Machine->Code Groups

Edit a group's properties and select the permission set tab. This tab allows you to select the permission set for the zone, you'll note that the "Trusted Zone" by default uses the Internet permission set which doesn't ReflectionPermission.

I recommend putting the site into the Local_Intranet zone, by default it has ReflectionPermission.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 6
Thank you. That actually makes things simpler.

Sincerely,
Buzzby

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...