473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do you use a .NET object in IE?

Hello everyone,

I am trying to load and use a .NET object in Web Page as described by
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpcondeployingco
mmonlanguageruntimeapplicationusingie55.htm

As a summary it says to use the Object tag with an classId similar to
classId=http://mydomain/path/myAssembly.dll#classname. Well, I've done this
and it appears that assembly has been downloaded and is being run. My
problem is, now that it is running locally in IE, how do I get the object to
do anything? I would like the object to manipulate the DHTML DOM but I
can't seem to find any documentation on this?

Any help (including what newsgroups might be more appropriate) would be
greatly appreciated.

Thanks,
Wells
Nov 22 '05 #1
7 1675
I would propose registering in GAC or putting assembly into same dir with iexplore.exe
Nov 22 '05 #2
Thanks for your reply, Eliahu.

I'm not really concerned with the load-time performace increase I could get
by putting my assembly in the GAC. In fact, I would have to use an
installer program to install my assembly in the GAC, which is undesirable
because I don't want the user to have to involved in that.

The problem that I am having is, assuming that my Assembly is already on the
target client machine, and even loaded into memory in IE, what interfaces
and/or classes do I need to implement in my classes in that assembly in
order to allow those classes to interact with the DHTML DOM?

Wells

"Eliahu Baker" <an*******@discussions.microsoft.com> wrote in message
news:65**********************************@microsof t.com...
I would propose registering in GAC or putting assembly into same dir with

iexplore.exe
Nov 22 '05 #3
Hi Wells,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know how to implement in
your classes in that assembly in order to allow those classes to interact
with the DHTML DOM. If there is any misunderstanding, please feel free to
let me know.

As far as I know, to access the DOM programmatically, you import both the
Web browser component and references to the methods, properties, and events
of the DOM into your C# project. You direct the Web browser to a URL by
calling its Navigate method, and you must then wait for the documentation
complete event. You obtain the document by casting the Web browser Document
property to an IHTMLDocument2 interface object. You can query this object
for its collections, such as its link or image collections, which are
returned as IHTMLElementCollection objects.

Here is an article for a walkthrough. HTH.

http://msdn.microsoft.com/library/de...us/dv_vstechar
t/html/vsgrfWalkthroughAccessingDHTMLDOMFromC.asp

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 22 '05 #4
This is very interesting!! I would love to do this for the project I'm
working on (.Net control running in IE). Are you able to either point me to
an example or perhaps send/paste some sample .net code for the object that
will be hosted in IE?

Thanks!
-Mike

"Wells Caughey" <we**********@hotmail.com> wrote in message
news:eu*************@TK2MSFTNGP12.phx.gbl...
Hello everyone,

I am trying to load and use a .NET object in Web Page as described by
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpcondeployingco mmonlanguageruntimeapplicationusingie55.htm

As a summary it says to use the Object tag with an classId similar to
classId=http://mydomain/path/myAssembly.dll#classname. Well, I've done this and it appears that assembly has been downloaded and is being run. My
problem is, now that it is running locally in IE, how do I get the object to do anything? I would like the object to manipulate the DHTML DOM but I
can't seem to find any documentation on this?

Any help (including what newsgroups might be more appropriate) would be
greatly appreciated.

Thanks,
Wells

Nov 22 '05 #5
Hi Kevin,

This is half of what I want to do. Let me give you some additional
background on what I am doing. I am building a website that is the primary
user interface for my company's products. To give our clients the best
possible experience using our product, we have enriched each of the website
pages with client-side script in form of DHTML Behaviors. These scripts
perform various tasks such as building HTML Tables, calling webservices, and
posting back collected data via XMLHTTP. So far, the site with the script
works fairly well, but the script is extremely slow and cumbersome to work
with. There are also memory leak issues caused by they way the scripting
engine interacts with MSHTML. So while using script is possible, it is not
very desirable.

What I want to do, is to replace some (if not all) of the script with a .NET
component. I want this component to be created and hosted by IE through the
<object> tag in such a way that I do not have to request .NET permissions
other than those granted by default to components running in the "Internet
Zone." Once the component represented by the <object> tag is loaded, I'm
going to want it to make changes to its containing HTML DOM in order to
render HTML tables and do all those things I do in script now.

So far I have written a test component and loaded it into a test HTML
document, but I don't know how to get a reference to the containing
document.

Your help in the matter is very appreciated.
Wells
"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:J6**************@cpmsftngxa10.phx.gbl...
Hi Wells,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know how to implement in
your classes in that assembly in order to allow those classes to interact
with the DHTML DOM. If there is any misunderstanding, please feel free to
let me know.

As far as I know, to access the DOM programmatically, you import both the
Web browser component and references to the methods, properties, and events of the DOM into your C# project. You direct the Web browser to a URL by
calling its Navigate method, and you must then wait for the documentation
complete event. You obtain the document by casting the Web browser Document property to an IHTMLDocument2 interface object. You can query this object
for its collections, such as its link or image collections, which are
returned as IHTMLElementCollection objects.

Here is an article for a walkthrough. HTH.

http://msdn.microsoft.com/library/de...us/dv_vstechar t/html/vsgrfWalkthroughAccessingDHTMLDOMFromC.asp

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 22 '05 #6
Hi Mike,

I am still in the research phase so I don't really have any code that would
be interesting. In all honesty, I don't even know if this is possible, but
if I find anything out, I'll be sure to post back into this same thread.

Wells

"Michael Riggio" <mi************@unisys.nospam.com> wrote in message
news:OC**************@TK2MSFTNGP10.phx.gbl...
This is very interesting!! I would love to do this for the project I'm
working on (.Net control running in IE). Are you able to either point me to an example or perhaps send/paste some sample .net code for the object that
will be hosted in IE?

Thanks!
-Mike

"Wells Caughey" <we**********@hotmail.com> wrote in message
news:eu*************@TK2MSFTNGP12.phx.gbl...
Hello everyone,

I am trying to load and use a .NET object in Web Page as described by

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpcondeployingco
mmonlanguageruntimeapplicationusingie55.htm

As a summary it says to use the Object tag with an classId similar to
classId=http://mydomain/path/myAssembly.dll#classname. Well, I've done

this
and it appears that assembly has been downloaded and is being run. My
problem is, now that it is running locally in IE, how do I get the

object to
do anything? I would like the object to manipulate the DHTML DOM but I
can't seem to find any documentation on this?

Any help (including what newsgroups might be more appropriate) would be
greatly appreciated.

Thanks,
Wells


Nov 22 '05 #7
Ok I think I understand what you are saying: Create an MSHTML sandwich. The
outer MSHTML instance loads a simple document that only contains the
<object> that points to my custom component. In turn, my custom component
hosts a MSHTML control and sets its location to the real HTML document. At
the very least, this will give me a good starting point.

Thanks for the help,
Wells

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:5W*************@cpmsftngxa10.phx.gbl...
Hi Wells,

Since you can load the text HTML document, I think you can get the path or
URL for the document. For example, in JavaScript we can use window.location to get the URL and pass it to methods in the assembly as a parameter. Then
you just load the document with Web browser component and let it parse to
IHTMLDocument2 interface object for you. This is the simplest way as far as I know.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object.cs in rotor. What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't...
0
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object class (Object.cs in rotor). What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What...
2
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object.cs in rotor. What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.