Solved

Is CreateObject("InternetExplorer.Application") incompatible with ASP?

Posted on 2006-07-15
13
1,213 Views
Last Modified: 2008-01-09
As part of a search engine I am developing, I was having trouble searching files and NOT searching the formatting.
If I opened each potential file as a textstream using a filesystemobject, I would end up unable to distinguish visible text from all the formatting strings, and occasionally end up with false matches.

To get around this, I thought perhaps I could have my ASP page open an InternetExplorer application, have IE open each file, and use IE.document.Body.innerText to get the visible text, which could then be searched.      I wasn't sure how slowly it would run, but I thought it would be effective.

However, it seems that my ASP page hangs on the line:
      Set IE = CreateObject("InternetExplorer.Application")

The page loading seems to run forever once it reaches this point, and doesn't seem to time out until after about 20 minutes!       I have experimented with commenting out lines, and I have confirmed that this line is definitely the source of the problem.

This leads to my questions:
- is there any way that I can open an IE application from ASP
- is there a way to set something so that if my page can't be loaded in a certain length of time, it times out, and the browser will display 'page can not be loaded'

               thanks,
                             PvBredow
0
Comment
Question by:PvBredow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +1
13 Comments
 
LVL 1

Expert Comment

by:kevinkcw
ID: 17116637
I think you're taking the long road. Why not just load the text into a variable and parse out the tags? Drop everything between and including '<' and '>', or use whatever the ASP equivalent to PHP's striptags() function is, and you're golden. If I'm missing your point entirely, I'm sorry.
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 17122581
You probably want to use ServerXMLHTTP instead of opening a browser on your web server.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/e5c17f89-0197-496c-9164-ce0bbbd8490f.asp
0
 
LVL 1

Expert Comment

by:kevinkcw
ID: 17126215
Is there a problem with that method if the html response is not properly formatted XML? Won't it bomb out?
0
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
LVL 6

Expert Comment

by:davecestria
ID: 17128574
ServerXMLHTTP will not help as it returns the full page source which PvBredow is trying to avoid happening, i think there must be a way to strip the tags out using ASP... i'll have a quick scout now.
0
 
LVL 6

Expert Comment

by:davecestria
ID: 17128601
You can use this function to strip the HTML tags from your page source using FSO and then search the documents viewable text.

<%
Function stripHTMLTags(val)
  set re = new RegExp
  re.pattern = "<[\w/]+[^<>]*>"
  re.global=true
  stripHTMLTags = re.replace(val,"")
End Function
%>
0
 

Author Comment

by:PvBredow
ID: 17135660
My original question related to whether it was possible to open an Internet.Explorer application from within ASP, and interact with it, such as to read IE.document.Body.innerText as a way to get the text.

I appreciate the responses, but they have all recommended alternate approaches, not the method I was asking about.

Since I couldn't resolve my original design problems, I have redesigned with a different approach, so this question is no longer important me.

Thanks for the suggestions, but I would now like to close/withdraw the question.
0
 
LVL 6

Accepted Solution

by:
davecestria earned 125 total points
ID: 17136466
" If I opened each potential file as a textstream using a filesystemobject, I would end up unable to distinguish visible text from all the formatting strings, and occasionally end up with false matches. "

" To get around this, I thought perhaps I could have my ASP page open an InternetExplorer application, have IE open each file, and use IE.document.Body.innerText to get the visible text, which could then be searched.      I wasn't sure how slowly it would run, but I thought it would be effective. "

We were offering alternatives to a problem you described above, you suggested usinging InternetExplorer.Application, although did not say this was the route that must be taken, using the InternetExplorer.Application takes a long time to process in my experience so in effect we were offering better solutions... but good luck anyway :o)

Dave
0
 
LVL 15

Assisted Solution

by:joeposter649
joeposter649 earned 125 total points
ID: 17143219
I wouldn't suggest running IE within ASP.  It's meant to run with logged in user interacting and would probably have similar problems as office...
http://support.microsoft.com/kb/q257757/

What would happen when js does an alert()?
Really, asp is the wrong platform for a web bot anyway.
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 17146933
If you want to keep trying to use IE the first thing I would do is check is that IUSR_MACHINE has permissions to C:\Documents and Settings\IUSR_MACHINE.
For testing maybe you could add IUSR_MACHINE to the admin group or try running your code as a vbs script.
0
 
LVL 6

Expert Comment

by:davecestria
ID: 17494337
I think we posted usable solutions... split is fine for me.
0

Featured Post

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question