468,760 Members | 1,926 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,760 developers. It's quick & easy.

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 #1
24 2791
"One" alternative is to use an http handler. This example
will get you off to a good start.

http://www.eggheadcafe.com/articles/hijacksession.asp

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp

"Randall Arnold" <ra************@nokia.com> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
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 #2
Thanks Robbe. C# makes this VB developer's head spin, and I'm obviously out
of my league based on what I've perused so far, but I'll see if I can get
anything useable out of your well-written article.

I thought this was going to be simple when I started... hoo boy... : (

Randall

"Robbe Morris [C# MVP]" <in**@eggheadcafe.com> wrote in message
news:eU*************@TK2MSFTNGP15.phx.gbl...
"One" alternative is to use an http handler. This example
will get you off to a good start.

http://www.eggheadcafe.com/articles/hijacksession.asp

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp

"Randall Arnold" <ra************@nokia.com> wrote in message
news:uG**************@tk2msftngp13.phx.gbl...
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 #3
Robbe Morris [C# MVP] wrote:
"One" alternative is to use an http handler. This example
will get you off to a good start.

http://www.eggheadcafe.com/articles/hijacksession.asp


A better choice would be to use a Response filter.

http://weblogs.asp.net/despos/archiv...01/145436.aspx

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.

Dec 29 '05 #4
Um, but what about this comment (from the link):

"The problem is that the response's output stream is write-only, presumably
for performance reasons. Any attempt to read the output stream fails"

Basically, I want to grab a table rendered by the asp.net code and copy it
to the clipboard. So far all suggested methods have failed. I'm sure what
I want to do *HAS* to be possible... just can't find out how...

Randall

"Jim Cheshire" <no*****@none.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Robbe Morris [C# MVP] wrote:
"One" alternative is to use an http handler. This example
will get you off to a good start.

http://www.eggheadcafe.com/articles/hijacksession.asp


A better choice would be to use a Response filter.

http://weblogs.asp.net/despos/archiv...01/145436.aspx

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.

Dec 29 '05 #5
Randall Arnold wrote:
Um, but what about this comment (from the link):

"The problem is that the response's output stream is write-only,
presumably for performance reasons. Any attempt to read the output
stream fails"

That comment applies to the PreSendRequestContent and not to a response
filter.

Basically, I want to grab a table rendered by the asp.net code and
copy it to the clipboard. So far all suggested methods have failed. I'm
sure what I want to do *HAS* to be possible... just can't find
out how...


I would seriously reconsider that desire. What is it that you are trying to
accomplish?

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.

Dec 29 '05 #6
This is the gist of it: our organization currently uses a VB6 program to
track and report quality issues. The developer is long gone and I have no
access to current source code.

I've been tasked to develop a new solution and the preference is web-based.
To that extent, I selected asp.net based on my experience with vb and
vb.net.

Users will view tables and charts on the intranet site and need to have the
ability to publish them in other applications (Word, Powerpoint, Publisher,
et al). I can easily copy the charts to any app because the chart object
has a method that creates bitmaps or metafiles on the fly, and even though
I'd rather copy the actual chart object, this will suffice.

The problem arises with copying tabular info. I've exhausted numerous ideas
and not one single one has worked unless it involves saving the table to an
html file, loading it in Word, copying the resulting table to the clipboard,
and pasting it. That's just plain nuts IMO. I can't understand why I can't
simply programmatically access the rendered html table, especially since I
can highlight it with a mouse, copy, paste and done. I should be able to
emulate that action in vb.net code, right? If I can't *I* have serious
reservations about the maturity level of asp.net.

Randall

"Jim Cheshire" <no*****@none.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Randall Arnold wrote:
Um, but what about this comment (from the link):

"The problem is that the response's output stream is write-only,
presumably for performance reasons. Any attempt to read the output
stream fails"

That comment applies to the PreSendRequestContent and not to a response
filter.

Basically, I want to grab a table rendered by the asp.net code and
copy it to the clipboard. So far all suggested methods have failed. I'm
sure what I want to do *HAS* to be possible... just can't find
out how...


I would seriously reconsider that desire. What is it that you are trying
to accomplish?

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.

Dec 29 '05 #7
Randall Arnold wrote:
I can't understand why I can't simply programmatically
access the rendered html table, especially since I can highlight it
with a mouse, copy, paste and done. I should be able to emulate that
action in vb.net code, right? If I can't *I* have serious
reservations about the maturity level of asp.net.
Randall


I went back and read your original post. It seems that you want to copy this
to the client clipboard. Is that correct? If so, can't be done in ASP.NET.
ASP.NET code doesn't execute on the client.

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.

Dec 30 '05 #8
Ok, I can understand that, but with all due respect I still can't accept
that I can't achieve this one way or another. Again, I have no problem
copying the chart graphic to the clipboard and bringing it into PowerPoint
with 2 simple lines of code, and it looks beautiful. I have to believe that
there is *some* way of copying a simple table over as well, without going
through contortions. I keep seeing hints that it can be done but either the
methods don't work for me or there aren't enough details provided. Someone
told me there's a way to stream the table to PowerPoint but provided no
other info. ???

Right now the 2 options I know I can use are the cumbersome html file
generation technique and building each and every table from scratch in
PowerPoint using vba with the interop. I have issues with either approach,
but I'll use the former if I have no other choice. MUCH less code.

The thing that gets me is I found an asp.net/JavaScript combo trick that
allows the user to toggle a table between hidden and visible. I got this to
work on the page in question. If I can do THAT, I have to believe I can use
a similar trick to copy the table. I just need to know the method.

Randall Arnold

"Jim Cheshire" <no*****@none.com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
Randall Arnold wrote:
I can't understand why I can't simply programmatically
access the rendered html table, especially since I can highlight it
with a mouse, copy, paste and done. I should be able to emulate that
action in vb.net code, right? If I can't *I* have serious
reservations about the maturity level of asp.net.
Randall


I went back and read your original post. It seems that you want to copy
this to the client clipboard. Is that correct? If so, can't be done in
ASP.NET. ASP.NET code doesn't execute on the client.

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.

Dec 30 '05 #9
Randall Arnold wrote:

The thing that gets me is I found an asp.net/JavaScript combo trick
that allows the user to toggle a table between hidden and visible. I
got this to work on the page in question. If I can do THAT, I have
to believe I can use a similar trick to copy the table. I just need
to know the method.


This is not an ASP.NET question. It is a question concerning client-script.
A quick Google search on "javascript clipboard" reveals thousands of hits.

I have to say as well that if you don't get your head around the fact that
ASP.NET is server side code with no connection to the client, you're going
to be quite confused as your development continues. This is the basic
foundation of ASP.NET and it's something that every ASP.NET absolutely must
know.

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.

Dec 30 '05 #10
Is there a reason you don't have set aside classes with public methods
to generate your charts, html tables, and other output mechanisms?

You could then wire up a few .NET Web Services to call these
specific methods from other parts of your web application or
even in VBA in Office applications.

It appears that you've put a bunch of this logic in your code
behind files. While this doesn't prohibit you from parsing
out particular pieces of info from the page, it does make
it more problematic.

You should refactor your asp.net pages and put the methods
to draw your html tables, charts, etc. in separate classes and
perhaps even in their own assembly.

This way, you can call the methods via web services and not have to bother
parsing anything. And, it would be easy to use the XmlHttp
object from the MSXML4 (or whatever the latest version is)
to call your web service via a macro in office. Now, you can call
the same method easily from external applications as well
as your asp.net application.

I think you've just architected yourself into a bad corner knowing
that you want to share output from your asp.net app to other
applications. You may want to review the following.
It will help you avoid these types of things in the future.

http://www.eggheadcafe.com/articles/...plications.asp

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp

"Randall Arnold" <rg******@cathartis.com_> wrote in message
news:eL*************@TK2MSFTNGP14.phx.gbl...
Ok, I can understand that, but with all due respect I still can't accept
that I can't achieve this one way or another. Again, I have no problem
copying the chart graphic to the clipboard and bringing it into PowerPoint
with 2 simple lines of code, and it looks beautiful. I have to believe
that there is *some* way of copying a simple table over as well, without
going through contortions. I keep seeing hints that it can be done but
either the methods don't work for me or there aren't enough details
provided. Someone told me there's a way to stream the table to PowerPoint
but provided no other info. ???

Right now the 2 options I know I can use are the cumbersome html file
generation technique and building each and every table from scratch in
PowerPoint using vba with the interop. I have issues with either
approach, but I'll use the former if I have no other choice. MUCH less
code.

The thing that gets me is I found an asp.net/JavaScript combo trick that
allows the user to toggle a table between hidden and visible. I got this
to work on the page in question. If I can do THAT, I have to believe I
can use a similar trick to copy the table. I just need to know the
method.

Randall Arnold

"Jim Cheshire" <no*****@none.com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
Randall Arnold wrote:
I can't understand why I can't simply programmatically
access the rendered html table, especially since I can highlight it
with a mouse, copy, paste and done. I should be able to emulate that
action in vb.net code, right? If I can't *I* have serious
reservations about the maturity level of asp.net.
Randall


I went back and read your original post. It seems that you want to copy
this to the client clipboard. Is that correct? If so, can't be done in
ASP.NET. ASP.NET code doesn't execute on the client.

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.


Dec 30 '05 #11
I understand that asp.net is server side.

What I am trying to say is that my overall solution is asp.net, but I am not
above implementing other technologies that can also work on an asp.net page
*client side*. To that extent, I spent 2 days exploring the JavaScript
clipboard links Google turned up. Not a single code example I tried worked
for my situation. The biggest problem is that they were all about copying
text; I want to copy a table object. Couldn't get that to work.

However, note that, as I said, copying the chart control contents (as a
bitmap) *works from the server side*. Obviously the clipboard CAN be
accessed; it is just not 100% functional, i.e., objects cannot be copied. I
am told this is a security issue. Since my application is strictly
intranet, I find this absurd, but that's another battle.

I have resigned myself to using Word as a table-rendering engine. It's
clunky, but it works.

Randall

"Jim Cheshire" <no*****@none.com> wrote in message
news:eq*************@TK2MSFTNGP09.phx.gbl...
Randall Arnold wrote:

The thing that gets me is I found an asp.net/JavaScript combo trick
that allows the user to toggle a table between hidden and visible. I
got this to work on the page in question. If I can do THAT, I have
to believe I can use a similar trick to copy the table. I just need
to know the method.


This is not an ASP.NET question. It is a question concerning
client-script. A quick Google search on "javascript clipboard" reveals
thousands of hits.

I have to say as well that if you don't get your head around the fact that
ASP.NET is server side code with no connection to the client, you're going
to be quite confused as your development continues. This is the basic
foundation of ASP.NET and it's something that every ASP.NET absolutely
must know.

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.

Jan 2 '06 #12
I am very new to asp.net/vb.net (although over 10 years with vb), and what
you describe is utterly foreign to me. If I knew what all that was, trust
me: I'd probably have done it.

Looks like I have a lot more to learn... and based on the poor luck I'm
having in searches, I don't even know where to start. No books, it seems,
geared toward what I am trying to do.

And FYI, it was never my intention to design myself into a corner: I had a
mandate to modernize a VB6 app and provide it with various publishing
(export) options, assumed asp.net was the way to go, and have now come to
the conclusion asp.net is far too immature, restrictive and poorly supported
despite the hype from Microsoft. IMO, I should not have to jump through
hoops or worry about security restrictions when my environment is 100%
intranet.

Randall

"Robbe Morris [C# MVP]" <in**@eggheadcafe.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is there a reason you don't have set aside classes with public methods
to generate your charts, html tables, and other output mechanisms?

You could then wire up a few .NET Web Services to call these
specific methods from other parts of your web application or
even in VBA in Office applications.

It appears that you've put a bunch of this logic in your code
behind files. While this doesn't prohibit you from parsing
out particular pieces of info from the page, it does make
it more problematic.

You should refactor your asp.net pages and put the methods
to draw your html tables, charts, etc. in separate classes and
perhaps even in their own assembly.

This way, you can call the methods via web services and not have to bother
parsing anything. And, it would be easy to use the XmlHttp
object from the MSXML4 (or whatever the latest version is)
to call your web service via a macro in office. Now, you can call
the same method easily from external applications as well
as your asp.net application.

I think you've just architected yourself into a bad corner knowing
that you want to share output from your asp.net app to other
applications. You may want to review the following.
It will help you avoid these types of things in the future.

http://www.eggheadcafe.com/articles/...plications.asp

--
Robbe Morris - 2004/2005 Microsoft MVP C#
http://www.eggheadcafe.com/forums/merit.asp

"Randall Arnold" <rg******@cathartis.com_> wrote in message
news:eL*************@TK2MSFTNGP14.phx.gbl...
Ok, I can understand that, but with all due respect I still can't accept
that I can't achieve this one way or another. Again, I have no problem
copying the chart graphic to the clipboard and bringing it into
PowerPoint with 2 simple lines of code, and it looks beautiful. I have
to believe that there is *some* way of copying a simple table over as
well, without going through contortions. I keep seeing hints that it can
be done but either the methods don't work for me or there aren't enough
details provided. Someone told me there's a way to stream the table to
PowerPoint but provided no other info. ???

Right now the 2 options I know I can use are the cumbersome html file
generation technique and building each and every table from scratch in
PowerPoint using vba with the interop. I have issues with either
approach, but I'll use the former if I have no other choice. MUCH less
code.

The thing that gets me is I found an asp.net/JavaScript combo trick that
allows the user to toggle a table between hidden and visible. I got this
to work on the page in question. If I can do THAT, I have to believe I
can use a similar trick to copy the table. I just need to know the
method.

Randall Arnold

"Jim Cheshire" <no*****@none.com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
Randall Arnold wrote:
I can't understand why I can't simply programmatically
access the rendered html table, especially since I can highlight it
with a mouse, copy, paste and done. I should be able to emulate that
action in vb.net code, right? If I can't *I* have serious
reservations about the maturity level of asp.net.
Randall
I went back and read your original post. It seems that you want to copy
this to the client clipboard. Is that correct? If so, can't be done in
ASP.NET. ASP.NET code doesn't execute on the client.

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

Latest entry: Digging into Objects
Describes the details of digging into
memory usage with the debugger.



Jan 2 '06 #13
Randall Arnold wrote:

And FYI, it was never my intention to design myself into a corner: I
had a mandate to modernize a VB6 app and provide it with various
publishing (export) options, assumed asp.net was the way to go, and
have now come to the conclusion asp.net is far too immature,
restrictive and poorly supported despite the hype from Microsoft. IMO, I
should not have to jump through hoops or worry about security
restrictions when my environment is 100% intranet.


Randall,

I think your problem is that you have undertaken a project that requires you
to have an understanding of HTTP applications and the restrictions imposed
on them, and because your experience is not in this area, you are becoming
frustrated. That happens to plenty of people. While it might be tempting to
blame the technology, I think doing so in this case is a mistake.

Yours is an issue that doesn't lend itself to resolution on a newsgroup
because your knowledge of the technology involved is limited. The best
recommendation one could give you is to purchase a book on ASP.NET (Dino
Esposito's books are excellent) and learn what you need to know to
competently develop this application. As you head down that road, I'm sure
that people here will be glad to help you.

--
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 2 '06 #14
It isn't an absolute lack of understanding, Jim. I wrote apps in VB6 that
used the webbrowser control to work all sorts of magic. I've designed web
pages that had to perform all kinds of tricks (based on customer requests)
and for a while I was adept at javascript just out of necessity (have since
forgotten most of it due to lack of use).

I understand HTML. I understand VB. I even understand ASP 2.0. I'm just
having problems with asp.net.

And while my lack of familiarity with asp.net is certainly a hindrance, it
isn't just that. There really ARE functional problems here. Again, the
asp.net security model seems to automatically assume Internet deployment,
and that cripples my 100% intranet solution. IMO this is a flaw in
Microsoft's philosphy. I believe a developer should be able to inform the
IDE that he is coding for a purely intranet environ and thus be rewarded
with expanded capabilities; conversely, I agree with the decision to lock
down many aspects of Internet apps.

Note that I can't even get IIS to run an aspx web page on my laptop, and
Microsoft's KB solution to this known issue did not work. Neither has ANY
recommended solution. That's just one of many, many frustrations
encountered.

I *am* understanding more and more, though, and very quickly. The more I
understand, however, the more disillusioned I become-- mainly due to the
restrictions mentioned above or the very poor (and often conflicting)
documentation I have encountered. As for asp.net books, I have several,
including Dino's, and not one has been any help whatsoever for the
application in question. I would dearly love to see a book that
specifically addressed developing and deploying 100% intranet solutions
using asp.net/vb.net. I'd pay good money for such a thing... but I'm not
holding my breath. I'm utterly amazed at the dearth of info on this
subject. The technology *should* lend itself very well to corporate
intranets but it seems MS has relegated that use to the backburner...

Randall Arnold

"Jim Cheshire" <no*****@none.com> wrote in message
news:Oe*************@TK2MSFTNGP09.phx.gbl...
Randall Arnold wrote:

And FYI, it was never my intention to design myself into a corner: I
had a mandate to modernize a VB6 app and provide it with various
publishing (export) options, assumed asp.net was the way to go, and
have now come to the conclusion asp.net is far too immature,
restrictive and poorly supported despite the hype from Microsoft. IMO, I
should not have to jump through hoops or worry about security
restrictions when my environment is 100% intranet.


Randall,

I think your problem is that you have undertaken a project that requires
you to have an understanding of HTTP applications and the restrictions
imposed on them, and because your experience is not in this area, you are
becoming frustrated. That happens to plenty of people. While it might be
tempting to blame the technology, I think doing so in this case is a
mistake.

Yours is an issue that doesn't lend itself to resolution on a newsgroup
because your knowledge of the technology involved is limited. The best
recommendation one could give you is to purchase a book on ASP.NET (Dino
Esposito's books are excellent) and learn what you need to know to
competently develop this application. As you head down that road, I'm sure
that people here will be glad to help you.

--
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 #15
Randall Arnold wrote:
It isn't an absolute lack of understanding, Jim. I wrote apps in VB6
that used the webbrowser control to work all sorts of magic. I've
designed web pages that had to perform all kinds of tricks (based on
customer requests) and for a while I was adept at javascript just out
of necessity (have since forgotten most of it due to lack of use).

I would dearly love to
see a book that specifically addressed developing and deploying 100%
intranet solutions using asp.net/vb.net. I'd pay good money for such
a thing... but I'm not holding my breath. I'm utterly amazed at the
dearth of info on this subject. The technology *should* lend itself
very well to corporate intranets but it seems MS has relegated that
use to the backburner...


Understood, but understand that working with the Webbrowser control is
nothing like developing an ASP.NET application. ;)

We certainly haven't ignored ASP.NET as an Intranet development tool. Many
of the companies I work with are developing Intranet applications and all of
our internal Web applications (and we use a TON of them) are ASP.NET apps
purely because it is so well suited to that type of environment.

Perhaps you can go into a bit more detail as to what makes you feel that
ASP.NET doesn't lend itself well to Intranets and we can help with that
specifically.

--
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 #16
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.

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.

These are just two examples of many. So far it's my experience that every
single hurdle I hit has Security as the crippling culprit. "Oh no," one MVP
tells me, "you NEVER want the clipboard to copy OBJECTS from web pages!"
Sure I do. I'm in an intranet. I'm not worried about malicious use. It's
not a factor. So why can't I have this capability, out of the box, in my
intranet app? I can copy bitmaps to the clipboard. I can copy raw text.
Just not a table. $%$%$@!

I understand the need for heightened security, and don't fault MS for
implementing it-- especially given the beating over publicized IE holes
(last week's big one to wit). But I also feel I should be able to pry the
hood open a little wider in an intranet.

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.

Randall Arnold

"Jim Cheshire" <no*****@none.com> wrote in message
news:uN**************@TK2MSFTNGP15.phx.gbl...
Randall Arnold wrote:
It isn't an absolute lack of understanding, Jim. I wrote apps in VB6
that used the webbrowser control to work all sorts of magic. I've
designed web pages that had to perform all kinds of tricks (based on
customer requests) and for a while I was adept at javascript just out
of necessity (have since forgotten most of it due to lack of use).

I would dearly love to
see a book that specifically addressed developing and deploying 100%
intranet solutions using asp.net/vb.net. I'd pay good money for such
a thing... but I'm not holding my breath. I'm utterly amazed at the
dearth of info on this subject. The technology *should* lend itself
very well to corporate intranets but it seems MS has relegated that
use to the backburner...


Understood, but understand that working with the Webbrowser control is
nothing like developing an ASP.NET application. ;)

We certainly haven't ignored ASP.NET as an Intranet development tool. Many
of the companies I work with are developing Intranet applications and all
of our internal Web applications (and we use a TON of them) are ASP.NET
apps purely because it is so well suited to that type of environment.

Perhaps you can go into a bit more detail as to what makes you feel that
ASP.NET doesn't lend itself well to Intranets and we can help with that
specifically.

--
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 #17
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 #18
"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."

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.

"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"
I'm thinking I didn't make myself clear.

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.

My head is spinning.

Randall Arnold

"Jim Cheshire" <no*****@none.com> wrote in message
news:e%****************@TK2MSFTNGP10.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 #19
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.com> wrote in message
news:e%****************@TK2MSFTNGP10.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 #20
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 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.com> wrote in message
news:%2****************@TK2MSFTNGP14.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 "applications" 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.com> wrote in message
news:Oc**************@TK2MSFTNGP10.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.com> wrote in message
news:Oc**************@TK2MSFTNGP10.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Atul | last post: by
4 posts views Thread by David Pendrey | last post: by
2 posts views Thread by DotNetShadow | last post: by
3 posts views Thread by DotNetShadow | last post: by
2 posts views Thread by J Williams | last post: by
11 posts views Thread by Lucky | last post: by
reply views Thread by Laurent Lequenne | last post: by
reply views Thread by Andy Bates | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.