Solved

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

Posted on 2006-07-15
13
1,189 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
  • 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

772 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