Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Disable Active-X Warning message, or alternate way to open a text file on local computer from webpage

Posted on 2004-11-21
Medium Priority
Last Modified: 2008-02-01
I developed a simple client-side application that runs through a web browser such as IE, and can connect to and modify a local access database while the user is interacting with html based pages.  One requirement is that I need to open a local text file at one point, and read some data from that textfile.  I've been using this method:

var firstvalue, secondvalue;
fso = new ActiveXObject("Scripting.FileSystemObject");            
f = fso.OpenTextFile(LOGFILE, 1);      
secondvalue =  f.ReadLine();
secondvalue =  f.ReadLine();
So basically I'm using an ActiveX object to read the file.  The problem with this is that every time I use this activex object, a warning window pops up asking if it is ok to allow this interaction.  "Allowing active content such as script and ActiveX controls can be useful, but active content might also harm your computer.  Are you sure you want to let this file run active content?"  This is no good, because the user will get very annoyed having to always say "yes" each time they use the application.  I don't know of another way to read data from a local textfile either, or I would use it.

Is there a way to access a text file on a local computer through a webpage (client side, no server) without warning messages poping up?  I know there are a lot of security settings in Internet Explorer involving ActiveX which I can disable, but even after disabling all of them this particular message still shows up.  On top of that, I don't necessarily have control over the computers this application will be installed onto (so I won't be able to go into their IE settings anyway), and other programs like Norton will also try and stop this script.  The funny thing is, I'm able to read and write (add records, remove records, etc) to a database to my hearts content without seeing any warning messages whatsoever, or even getting permission from the user, but when I want to read (not write) from a simple text file, all these red flags start going off.

Maybe I can somehow register the active-x control on a local computer so that the warnings go away?  Or is there a different way to read a local text file from an html page?

Thanks in advance
Question by:nexisvi
LVL 19

Accepted Solution

webwoman earned 300 total points
ID: 12645527
It's a security feature. You cannot disable it. You're accessing info on the USER'S computer. They should know that.

Why not just write an actual app that they install and run locally that connects to the web? Then you'd have permission on their system (it would be a local app), and they wouldn't get security prompts.

Author Comment

ID: 12646521
I don't understand why I'm able to access a database file on their computer, make modifications to it, and even delete records, and it doesn't give a single prompt or ask for permission... yet to just read from a file ... anyway

The main issue is that I didn't write this app, and I don't have access to the original source.  What they wanted was a quick way to do some database modifications through web based forms (viewed internally in the application), without having to modify the original app.  Currently the app has the ability to launch webpages internally (through an embeded IE browser it seems using Visual Basic), it's easy to code some simple html forms, and link them to an access database.  The problem is that I need to read a "log" file to determine which record is currently locked.  That's how I know which record the user is working on inside the application.  There is no way for the app to communicate this to the webpage, unfortunately.  It's out of my control, but the way the app launches internal webpages is by reading another file, which was created ahead of time, that tells it which html files to launch.  That eliminates me being able to do something like "myforms.html?recordid=5", because you don't know what record they will be working on ahead of time.

There must be some sort of trick to getting the info I need from the log file?  I was reading about using innerText, outerText, etc.  But it seems like I'd need some tags in the file I want to read from, and this log file does not have tags.
LVL 53

Assisted Solution

COBOLdinosaur earned 75 total points
ID: 12648890
The web page is not modifying or insert into the database; the vb app is, using a privileged mode however for the read you are doing it from a web page with activeX and that does not have a privileged mode.  The read either has to be done in the VB app or your user's have to live with warnings.  The warnings are necessary because there must be assurance that information on the Hard drive cannot be accessed by a web page with the user knowing what is going on.  Otherwise it would be a huge security hole that would quickly be exploited by hackers to steal information from client computers.


Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

564 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