Click to See Complete Forum and Search --> : edit hosts file
ober0330
Feb 12th, 2004, 09:16 PM
I want to be able to apply a "patch" to a users computer to change their hosts file so that they can put in a keyword to access my server on our local intranet.
Is this possible with Javascript?
Also, could I tell which version of windows is being used and possibly the Windows directory?
Acidic
Feb 13th, 2004, 04:30 AM
JavaScript can definately not detect what version of windows in running and what folder it is in. but surely in an intranet, it would be the same on every pc.
JavaScript cannot edit/move/create/delete files either
ober0330
Feb 13th, 2004, 06:49 AM
>>but surely in an intranet, it would be the same on every pc.
Surely you're joking, right? I'm talking about several hundred PCs all at different levels of upgrades.
And if I can't edit files using Javascript, what should I use?
Acidic
Feb 13th, 2004, 06:52 AM
PHP, or Java could maybe do it. ActiveX can, I think. I'd think VB would be the best app to run though. I'd ask this question in the VB forum, being more specific with what you want the "patch" to do.
ober0330
Feb 13th, 2004, 06:58 AM
PHP is server side only! How would it get the browser to access the file?
Acidic
Feb 13th, 2004, 06:59 AM
OK, my mistake, maybe PHP won't do it. VB and ActiveX should though.
ober0330
Feb 13th, 2004, 07:00 AM
Do you really think I'd ask this here if I wanted a VB solution? I want to make it so that they can go to a website, click a button and .... "wa la" all is fine and dandy.
Acidic
Feb 13th, 2004, 07:01 AM
try ActiveX then:rolleyes:
crptcblade
Feb 13th, 2004, 07:15 AM
Java and PHP are server-side only. And only a fool would give ActiveX the authority to have file access. This is something that just isn't feasible from a web app, unless it's in an intranet setting where the software can be trusted.
Acidic
Feb 13th, 2004, 07:18 AM
so really it should be VB or C?
ober0330
Feb 13th, 2004, 07:48 AM
Originally posted by crptcblade
This is something that just isn't feasible from a web app, unless it's in an intranet setting where the software can be trusted.
Exactly. It is on our intranet. Neither the database or this patch would be accessible to outside users. SOO... the software can be trusted.
So do you know of a way to get this done?
crptcblade
Feb 13th, 2004, 08:43 AM
As was said before, use ActiveX. Read up on File Scripting Objects.
ober0330
Feb 13th, 2004, 08:47 AM
OK, I have to be honest. I don't know is meant when someone says "use ActiveX". Does that mean create a DLL, or does that mean I have to create some kind of control like in VB?
And how is that deployed?
-lost, confused, in need of help. :(
crptcblade
Feb 13th, 2004, 08:55 AM
I've never used ActiveX on a website before, but there should be no need to deploy anything as long as you are not doing anything fancy.
Just use VBScript to run the FSO...
Sub UpdateFile
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
'run your update code
Set fso = Nothing
End Sub
And you should be able to call the sub just as you would call a javascript function.
ober0330
Feb 13th, 2004, 08:58 AM
Do I need to have anything special setup on the server to handle vbscript? (I'm assuming you might not know this if you've never used it in a web arena).
Acidic
Feb 13th, 2004, 09:31 AM
no, VbScript should work straight away, though only in IE. on an intranet I don't think that matters though,
ober0330
Feb 13th, 2004, 09:33 AM
I'm getting errors that it cannot create the FSO :(
Acidic
Feb 13th, 2004, 09:45 AM
sorry, but I don't know how to use ActiveX in web pages, try google.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.