|
| .NET, DHTML, Web client, DOM access and rendering behaviors ! |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.dotnet.languages.jscript.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
| mike |
| GOOD ANSWER |
Anyone out there help with these questions or point me in the right direction.
1) I currently use DHTML binary rendering behaviours - what is the equivalent in .NET? Can a .NET component supporting the correct COM interfaces be used as a rendering behaviour from an <OBJECT> tag?
2) How can a .NET winform control obtain the IHTMLDocument interface for a browser page which is containing it?
3) Can JSCRIPT on the client call exposed public methods in a .NET winform control also on the web page?
4) All winform controls which I have created seem to be windowed. Is there an equivalent of a windowless activeX? (so that z-ordering works with the cotnrol and other HTML elements on the page)
Many Thanks
Mike Ginns
@SRCHKEY@
|
|
|
| |
|
|
| |
| |
| Peter Torr \(MS\) (VIP) |
| GOOD ANSWER |
"mike" <Click here to reveal e-mail address> wrote in message news:lFVY7.32703$Click here to reveal e-mail address... [Original message clipped]
In theory, yes. I don't know what interfaces these are exactly, but you should be able to TLBIMP the appropriate type library and go from there. You may need to do some custom interop or even drop down to MEC++ for some things, but it should at least be possible.
[Original message clipped]
Presumably the same way that an ActiveX control does; alas I don't know the details here, but it sounds like you might have some background in this area.
[Original message clipped]
Certainly; JScript (or VBScript) code on the client can access any public member of the control. The thing they can't do (by default) is handle events, because that requires you to do some extra work. Search http://www.deja.com/ for more information about this if you are curious. Be forewarned though that it requires giving your control FullTrust.
[Original message clipped]
Sorry, I don't know about this. I would guess not though.
Peter
-- Peter Torr -- Click here to reveal e-mail address -- JScript .NET / VSA Runtime Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm Please post all questions to the group. Thanks.
|
|
|
| |
|
|
| |
| |
| Oleg Mihailik |
| GOOD ANSWER |
> > 3) Can JSCRIPT on the client call exposed public methods in a .NET winform [Original message clipped]
I have an idea. In .NET controls we need create property of type System.Object. At client (JScript/DHTML) side we will assign this property something like this:
netObject.emulatedEvent=clientEventFunction; . . . clientEventFunction() { alert("OK"); }
and at .NET control side we will invoke this property as method, from within JScript NET code:
if( emulatedEvent!=null ) emultatedEvent();
really it is just workaround, but it must works without any trust from client browser. Oleg Mihailik.
|
|
|
| |
|
|
| |
| |
| Peter Torr \(MS\) (VIP) |
| GOOD ANSWER |
"Oleg Mihailik" <Click here to reveal e-mail address> wrote in message news:eKnRuVUlBHA.2168@tkmsftngp05... [Original message clipped]
Hi,
This is a partial workaround as it gets past the problems with sourcing COM events from .NET controls, but it still requires FullTrust (well, UnmanagedCodePermission to be exact, but they're morally equivalent) as you are calling into COM code from .NET.
Peter
-- Peter Torr -- Click here to reveal e-mail address -- JScript .NET / VSA Runtime Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm Please post all questions to the group. Thanks.
|
|
|
| |
|
|
| |
| |
| Oleg Mihailik |
| GOOD ANSWER |
[Original message clipped]
It seems you are wrong. My class expose normal .NET property of type System.Object. Host is responsible to assign something to this property. And this something must be of type System.Object. Yes, it will be RCW, Runtime Callable Wrapper, but this is host's problem.
My object say: hey, you can give me object and I know what to do. It is problem of host to pass any security checks.
Oleg Mihailik.
|
|
|
| |
|
|
| |
| |
| Peter Torr \(MS\) (VIP) |
| GOOD ANSWER |
"Oleg Mihailik" <Click here to reveal e-mail address> wrote in message news:#kG311BmBHA.1744@tkmsftngp07... [Original message clipped]
Sure, that works fine but we are talking about Internet Explorer as the host here. If you are running code off your local machine, it can do anything it wants. If you are running code off the internet, it better not be able to call COM code or else you are toast!
[Original message clipped]
.... and the URL based evidence in the security policy ensures that things from the internet cannot call COM objects, including JScript (or VBScript) event handlers on a web page.
There are two source files at the end of the post. Save them to your wwwroot drive and try this:
1) Compile the source to a DLL:
jsc /t:library testcontrol.js
2) Adjust security so that your local machine has FullTrust (command may wrap):
caspol -ag 1.2 -url http://localhost/* FullTrust -name MyMachine
3) Open a NEW INSTANCE of Internet Explorer (not just a new window) and navigate to http://localhost/testcontrol.html" target="_blank">http://localhost/testcontrol.html
4) Click the button. You should see the alert "Hello from client script"
5) Close IE.
6) Restrict your local machine to the Intranet zone:
caspol -cg MyMachine LocalIntranet
7) Open a NEW INSTANCE of Internet Explorer (not just a new window) and navigate to http://localhost/testcontrol.html" target="_blank">http://localhost/testcontrol.html
8) Click the button. You should see a security error
9) Close IE.
10) Restrict your local machine to the Internet zone:
caspol -cg MyMachine Internet
11) Open a NEW INSTANCE of Internet Explorer (not just a new window) and navigate to http://localhost/testcontrol.html" target="_blank">http://localhost/testcontrol.html
12) Click the button. You should see a security error
13) Close IE.
Peter
-- Peter Torr -- Click here to reveal e-mail address -- JScript .NET / VSA Runtime Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm Please post all questions to the group. Thanks.
////////////////////////////// // ----- testcontrol.js
import System import System.Drawing import System.Windows.Forms
class Test extends Control { var TheEvent
function Test() { var b = new Button b.Text = "Click Me" b.Size = new System.Drawing.Size(100, 100) b.add_Click(Handler) Controls.Add(b) }
function Handler(o, e : EventArgs) { TheEvent() } }
////////////////////////////// // ----- testcontrol.html
<body onload="bar.TheEvent = function() { alert('Hello from client script') }"> <object id="bar" classid="TestControl.dll#Test" height=100 width=100></object> </body>
|
|
|
| |
|
|
| |
| |
| Oleg Mihailik |
| GOOD ANSWER |
[Original message clipped]
You are right. I'm very excited, .NET really do security checks in this case. Unbelieveably! Thank you, Peter, for explaining.
Oleg Mihailik
|
|
|
| |
|
|
| |
|
| |
| Oleg Mihailik |
| GOOD ANSWER |
[Original message clipped]
You are right. I'm very excited, .NET really do security checks in this case. Unbelieveably! Thank you, Peter, for explaining.
Oleg Mihailik
|
|
|
| |
|
|
| |
|
| |
| Tim Kohler |
| GOOD ANSWER |
(Type your message here)
-------------------------------- From: Tim Kohler
I'm trying to do this with a C# control and I'm at a loss as to how to call the 'emulatedEvent' (which is an object). I would think you could define a public event in your control and have the javascript 'subscribe' to that event and then just fire the event from within the control.
Peter, is this possible and can you help convert your above example to C#?
thanks Tim
|
|
|
| |
|
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|