473,748 Members | 10,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can you use mshtml DOM object to grab rendered asp.net page?

I know how to use MSHTML to grab the innerhtml from an html web page, but
what if I want to look at elements of a rendered aspx page? Is there any
way to do this using the MSHTML DOM object?

Thanks,

Randall Arnold
Dec 29 '05
24 2977
Something I forgot to respond to:

If simple things like automating Office apps and copying html elements
cannot be handled by asp.net, then I have no choice but to call it quits. I
will have to tell my customers that what they want (a web-based quality
reporting system) is a complete impossibility. That won't sit too well with
some. To put it bluntly, this is what I was hired for, and if it can't be
done, I have to update my resume and prepare to lose the sweetest gig I ever
landed.

: (

Randall Arnold

"Jim Cheshire" <no*****@none.c om> wrote in message
news:e%******** ********@TK2MSF TNGP10.phx.gbl. ..
Randall Arnold wrote:
In general, my problem is that right off the bat I run into security
obstacles. I mentioned one, the inability to use IIS on my laptop to
run an aspx page. Searching on the subject led me to suggestions
involving batch files running CACL commands. Not a single CACL call
I executed was successful. Sigh. The suggestion to add a new user
to machine.config failed because the server didn't recognize the
recommended username value. Other recommendations all involve
registry hacks, text file editing, etc etc etc-- all very crude
solutions IMO and not one tried has worked. So, specifically, I
still cannot execute aspx files on my development pc using IIS.

First of all, you don't need to run CACLS to run ASP.NET pages. What
problems were you having?

If you do have a need to run CACLS from a Web page, we have plenty of
people doing this and it will work. However, once again, you have to
understand the architecture. You must make sure that you do one of two
things:

1. Either run the worker process under a privileged user who can run
CACLS. (Not recommended, Intranet or not.)
2. Impersonate a privileged user who can run CACLS.

Number 2 is the strong recommendation, and in this type of scenario, it
would be strongly advisable to use code-level impersonation.
I've already belabored the clipboard dilemma that has cost me
countless hours of deadend trial and error. I have a solution now
that works, but I'm still disgusted that there's no clean way to do
what I wanted and that I had to resort to a kludge that uses Word as
a table-copying engine. Which brings up another gripe: THAT solution
won't run from my server. The error is that Word can't be started. I
assume this means Word needs to be installed on the server (I had
assumed the interop would create the instance on the client machine--
oops). But I guarantee you the IT guys I have to deal with on this
will nix that. So now my solution is kaput. Back to square 1: I
still cannot copy a simple html table from a web page to a Powerpoint
application, a feature my application MUST have. That confounds and
astounds me.

Once again, this is an architectural issue. Office applications are not
designed to be run non-interactively. When they load up, they load up
user-specific settings from the profile. When you are running your ASP.NET
app, the worker process is running under the context of a non-interactive
user and automation of Office applications is not supported.

Even if you can get it to work, doing it would be highly inadvisable due
to resource problems that would likely be encountered. This is not an
architectural flaw. It simply has to do with the fact that Windows
applications are designed to be run by the one person logged into the
console and not by a large number of users accessing a Web application.

Sorry to beat this dead horse-- but I have a project upon which key
managers have pinned high expectations and it's frustrating to me to
hit so many walls over what I had presumed to be minor details. I
can create this app in VB6. I can even create it in vb.net winforms.
But for various reasons I prefer asp.net webforms. And I hate having
to call it quits, but it sure looks like I'll have to. A shame. I
was really excited at what I thought asp.net could do.

I don't think you have to call it quits. However, I do think (as I've said
before) that you need to do some work up-front in understanding the
achitecture you are using. Doing so will ease your frustration and will
allow you to create better and more robust applications.

--
Jim Cheshire
=============== =============== ==
Blog: http://blogs.msdn.com/jamesche

Latest entry:
Getting the PID and TID of a COM Call

Describes how to get the PID of the
dllhost process a COM call is executing
in and how to locate the thread as well.

Jan 3 '06 #21
The suggestion to run CACLS was in the form of numerous commands that added
user rights via a batch file run on the desktop, not from the web page per
se. This was in order to allow IIS to execute aspx pages on the desktop. I
don't recall the exact error, but a google search on it led me to (brace
yourself) an MSKB article that purported to have the fix. I dutifully
performed the suggested steps (create DOS batch file with CACLS commands)
that Microsoft delineated. Each execution was followed by a system message
that nothing happened. The other suggestion was to add the username
attribute. Visual Web developer's server says the attribute is invalid.

Sigh.

As for Office not being designed to be automated as I am attempting, then
what are Interops for? What's with all the advertisements alluding to such
a capability? Where is Office going next-- seeing as how at least one
(ahem) MS competitor is poised to offer this sort of thing (and then some)?

My head quit spinning. It just hurts now.

Randall Arnold

"Jim Cheshire" <no*****@none.c om> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Randall Arnold wrote:

The only thing that led me to CACLS was, as I said, suggestions to
allow IIS to run aspx pages on my laptop. I reall don't care WHAT
method I use, as long as it works. Again, no suggestion I've tried
has worked. All have produced errors. I've given up on this for the
time being.


Understood. My point is that without knowing what errors you received,
there's no way to help. However, whomever told that you running CACLS
from your ASP.NET pages is a solution to ASP.NET pages not running is
dumber than a sack of hammers. How are you supposed to run CACLS from your
ASP.NET page if your ASP.NET page won't run? :)


I don't want several users trying to run a single Windows app. I
want the asp.net page firing up a *local* copy of the necessary
app(s) as needed (ergo, MULTIPLE local instances). I had assumed
this would be no big deal. I understand your explanation about
server-run apps but since that's not what I want to do I'm thinking
there shouldn't be a problem. If what I want to do CAN'T be done,
then I'm flabbergasted, and not due to lack of familarity with the
platform-- this appears to me to be a no-brainer. If intranet users
can't rely on a server-based app to automate the Office apps on their
desktop, why not? I'm not looking for interactivity anyway: I simply
want to automate (one way) the publishing of charts, tables and
graphics that reside on an intranet web page into various Office
document forms. I thought this was part of the office automation
Nirvana MS has been advertising for years.


Not much more I can say here. Office was not designed to work this way.

--
Jim Cheshire
=============== =============== ==
Blog: http://blogs.msdn.com/jamesche

Latest entry:
Getting the PID and TID of a COM Call

Describes how to get the PID of the
dllhost process a COM call is executing
in and how to locate the thread as well.

Jan 4 '06 #22
Randall Arnold wrote:
The suggestion to run CACLS was in the form of numerous commands that
added user rights via a batch file run on the desktop, not from the
web page per se. This was in order to allow IIS to execute aspx
pages on the desktop. I don't recall the exact error, but a google
search on it led me to (brace yourself) an MSKB article that
purported to have the fix. I dutifully performed the suggested steps
(create DOS batch file with CACLS commands) that Microsoft
delineated. Each execution was followed by a system message that
nothing happened. The other suggestion was to add the username
attribute. Visual Web developer's server says the attribute is
invalid.

Can you tell me what KB article? I'll have a look and get it updated or
pulled if it's misleading.


As for Office not being designed to be automated as I am attempting,
then what are Interops for? What's with all the advertisements
alluding to such a capability? Where is Office going next-- seeing
as how at least one (ahem) MS competitor is poised to offer this sort
of thing (and then some)?

Interop is for calling COM components from managed code. You can certainly
use interop to automate Office from a Windows app. However, Office
applications are not designed for automation in a non-interactive
environment. If a competitive product is going to offer that, I'd watch
out. It's a design nightmare and a bad decision on their part in my opinion.
Applications with a UI should not be automated via a Web application.

One other thing you might want to keep in mind. Web applications should
ALWAYS be designed to run with no one logged in at the console. Give that a
thought and you might understand better what I'm talking about. This is not
an ASP.NET design issue. :)

--
Jim Cheshire
=============== =============== ==
Blog: http://blogs.msdn.com/jamesche

Latest entry:
Getting the PID and TID of a COM Call

Describes how to get the PID of the
dllhost process a COM call is executing
in and how to locate the thread as well.

Jan 4 '06 #23
I'll have to search on that MSKB article again, and post a link.

On one hand I understand what you're getting at re automating Office, but on
the other hand I'm still puzzled. In the intranet scenario I described,
there's no way any of the webform apps would be run with no one logged in.
That defies the very purpose, ie, for users to view production statistics
relevant to their particular operation (or all stats for upper level
managers)-- this access is restricted by function. It would operate much
like many of the industrial web apps out there, only specifically in an
intranet environ. Log in, click a few SQL parameters, export a report.
Done. Using Winforms is problematic due to security issues here: IT is
antagonistic toward developers like myself which means odds are I will never
have the rights to install a Windows app, nor will they manage that effort.
Which means that, up until now, this sort of activity has been done in ad
hoc "cowboy" fashion and that is what I'm trying to avoid. Too many
unmanaged and unsupported Access and Excel "applicatio ns" here. I want to
do better.

To me the original premise was so simple I'm blown away by what I've
encountered. All I wanted was to enable users to log in, see their metrics,
and generate a report that could be shared in meetings (we typically use
Excel and Powerpoint for this). The work involved is right now so
cumbersome and prone to error that automating it is not only a luxury but
pretty much a necessity. When I agreed to develop this it seemed like such
a straightforward application, based on what's seen all over the Internet,
so I dived right in. Now I'm disillusioned, and perplexed by how other
developers pull off what they do in web apps. The only thing I can hope for
now is that the Aspose products work as advertised, and that the manager
here will come up with the cash for them...

Randall

"Jim Cheshire" <no*****@none.c om> wrote in message
news:Oc******** ******@TK2MSFTN GP10.phx.gbl...
Randall Arnold wrote:
The suggestion to run CACLS was in the form of numerous commands that
added user rights via a batch file run on the desktop, not from the
web page per se. This was in order to allow IIS to execute aspx
pages on the desktop. I don't recall the exact error, but a google
search on it led me to (brace yourself) an MSKB article that
purported to have the fix. I dutifully performed the suggested steps
(create DOS batch file with CACLS commands) that Microsoft
delineated. Each execution was followed by a system message that
nothing happened. The other suggestion was to add the username
attribute. Visual Web developer's server says the attribute is
invalid.

Can you tell me what KB article? I'll have a look and get it updated or
pulled if it's misleading.


As for Office not being designed to be automated as I am attempting,
then what are Interops for? What's with all the advertisements
alluding to such a capability? Where is Office going next-- seeing
as how at least one (ahem) MS competitor is poised to offer this sort
of thing (and then some)?

Interop is for calling COM components from managed code. You can certainly
use interop to automate Office from a Windows app. However, Office
applications are not designed for automation in a non-interactive
environment. If a competitive product is going to offer that, I'd watch
out. It's a design nightmare and a bad decision on their part in my
opinion. Applications with a UI should not be automated via a Web
application.

One other thing you might want to keep in mind. Web applications should
ALWAYS be designed to run with no one logged in at the console. Give that
a thought and you might understand better what I'm talking about. This is
not an ASP.NET design issue. :)

--
Jim Cheshire
=============== =============== ==
Blog: http://blogs.msdn.com/jamesche

Latest entry:
Getting the PID and TID of a COM Call

Describes how to get the PID of the
dllhost process a COM call is executing
in and how to locate the thread as well.

Jan 4 '06 #24
Ok, I'm breathing easier now.

I figured out how to add the user permissions in order to run aspx pages on
my laptop under IIS.

I have also determined that I can achieve my reporting goal by utilizing mht
(html archive) pages as the common denominator. I will add an asp.net
mht-generator component to my solution and layout web pages exactly as they
should appear within the published destinations (rendering some elements
invisible at time of export if need be). I will use vbscript client-side
(instead of interops and vb.net server side) to instantiate Word,
Powerpoint, et al and load the generated mht along with some scripted
formatting where needed.

Not exactly what I was shooting for, but it will work. I think. Tests so
far are good.

Thanks for putting up with my exasperated rants.

Randall Arnold

"Jim Cheshire" <no*****@none.c om> wrote in message
news:Oc******** ******@TK2MSFTN GP10.phx.gbl...
Randall Arnold wrote:
The suggestion to run CACLS was in the form of numerous commands that
added user rights via a batch file run on the desktop, not from the
web page per se. This was in order to allow IIS to execute aspx
pages on the desktop. I don't recall the exact error, but a google
search on it led me to (brace yourself) an MSKB article that
purported to have the fix. I dutifully performed the suggested steps
(create DOS batch file with CACLS commands) that Microsoft
delineated. Each execution was followed by a system message that
nothing happened. The other suggestion was to add the username
attribute. Visual Web developer's server says the attribute is
invalid.

Can you tell me what KB article? I'll have a look and get it updated or
pulled if it's misleading.


As for Office not being designed to be automated as I am attempting,
then what are Interops for? What's with all the advertisements
alluding to such a capability? Where is Office going next-- seeing
as how at least one (ahem) MS competitor is poised to offer this sort
of thing (and then some)?

Interop is for calling COM components from managed code. You can certainly
use interop to automate Office from a Windows app. However, Office
applications are not designed for automation in a non-interactive
environment. If a competitive product is going to offer that, I'd watch
out. It's a design nightmare and a bad decision on their part in my
opinion. Applications with a UI should not be automated via a Web
application.

One other thing you might want to keep in mind. Web applications should
ALWAYS be designed to run with no one logged in at the console. Give that
a thought and you might understand better what I'm talking about. This is
not an ASP.NET design issue. :)

--
Jim Cheshire
=============== =============== ==
Blog: http://blogs.msdn.com/jamesche

Latest entry:
Getting the PID and TID of a COM Call

Describes how to get the PID of the
dllhost process a COM call is executing
in and how to locate the thread as well.

Jan 5 '06 #25

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

Similar topics

10
44478
by: Atul | last post by:
Hi, I just stepped into C#. I am facing one problem. Here is the scenario. I am posting some data to one website (https site). It returns me response HTML. I want to parse this HTML and want to look for some specific tags. To achieve the same, I wanted to use MSHTMLs HTMLDocumentClass Interface. I dont know how to use it in C#. I am using .NET framework 1.1. For posting the data, I am using XMLHTTP class. Any help is highly appreciated.
4
17645
by: David Pendrey | last post by:
Hello all, I am using the WebBrowser control to browse a webpage containing frames and am having difficulties accessing the 'frames' property of a document object. Bellow is my code and the error recieved: webAccess.Navigate(URL); // Wait until document is loaded. This part DOES work IHTMLDocument2 mDoc = (IHTMLDocument2)(webAccess.Document); IHTMLFramesCollection2 mFrames = (IHTMLFramesCollection2)(mDoc.frames);
2
3758
by: DotNetShadow | last post by:
Hi Guys, I have been reading heaps of information in regards to MSHTML object being used in .NET applications, windows and UI-less. I have read the walkall samples and tried various techniques with MSHTML. My biggest problem seems to be running MSHTML in asp.net application and looping elements in the document. Example:
4
3311
by: Lars-Erik Aabech | last post by:
Hi! I've been walking in extacy since reading the article about test automation with IE in the latest MSDN mag. (http://msdn.microsoft.com/msdnmag/issues/05/10/TestRun/default.aspx) After a while, I had to find an issue I couldn't solve. (Of course) If an ASP.NET page uses the smartnav option, the document you get from IE only contains the viewstate input etc, the scripts and an IFrame.
3
2761
by: DotNetShadow | last post by:
Hi Guys, I have been reading heaps of information in regards to MSHTML object being used in .NET applications, windows and UI-less. I have read the walkall samples and tried various techniques with MSHTML. My biggest problem seems to be running MSHTML in asp.net application and looping elements in the document. Example:
2
3291
by: J Williams | last post by:
I'm using the WebBrowser control and mshtml library to modify the HTML in a web page. E.g. the code below is meant to change all .txt links to .zip, but doesn't because mAnchorElement is just a copy of mElement and doesn't reference mElement and any changes I make to it affect the copy and not mElement. Private Sub Web1_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles...
11
2362
by: Lucky | last post by:
hi guys, i need to parse html data that i've got from "Inet" object in vb6. now i want to prase the html data. here i got 2 options. one is MSXML and other is MSHTML. i tried both of them but i didnt get anything out of them. MSXML doesnt works with some keywords and consider some letters as operator so i cant go with MSXML. i tried MSHTML but it doesnt provide any way to parse the HTML data you got from other source. there is a...
0
1548
by: Laurent Lequenne | last post by:
Hello All, I'm currently developing a free windows Scrabble (in french :)) application that uses extensively the WebBrowser class of NET 2.0 for configuration, and data browsing. It works 100% on my machine, with the WebBrowser Class, and the Microsoft.MsHtml component. I can access all elements on the pages through the events, I can change some parts. Everything is rendered with XSLTs and changing directly the document through the msHtml...
0
3577
by: Andy Bates | last post by:
Hi - This issue seems to have been kicking around since the dawn of time and no one appears to have come up with an answer. In short the MHT/MSHTML provides a method of archiving an HTML page into a single MIME encoded file that specifies all of the resources for a page in a single file. This makes a lot of sense as if you could pass one of these to the
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8828
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9537
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3309
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.