Solved

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

Posted on 2006-07-15
13
1,171 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
Comment Utility
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
Comment Utility
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
Comment Utility
Is there a problem with that method if the html response is not properly formatted XML? Won't it bomb out?
0
 
LVL 6

Expert Comment

by:davecestria
Comment Utility
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
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:PvBredow
Comment Utility
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
Comment Utility
" 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
Comment Utility
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
Comment Utility
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
Comment Utility
I think we posted usable solutions... split is fine for me.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now