473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Server-side scripts with ASP

Sorry if this is an easy question.

Does Javascript work "out of the box with IIS" as an
Active server page? ie. does it have the ability to open files
ect.?

I tried this command and it does not seem to work.

var fileSys;
var txtFile;
fileSys = new ActiveXObject("Scripting.FileSystemObject");
txtFile = fileSys.OpenTextFile("./junk.txt",1,false);

I can't find examples on the web. What would I search for to find out
about objects the Scripting.FileSystemObject?

Background
I work at a large company with a corperate IT group.
I need to write some server side scripts. The servers they
have are Windows 2000 with IIS installed. If additional
software needs to be installed I will be forced to use VBscript.

Bill

Jul 20 '05 #1
5 5747
Hi,

Bill Sneddon wrote:
Sorry if this is an easy question.

Does Javascript work "out of the box with IIS" as an
Active server page? ie. does it have the ability to open files
ect.?
Yes. You don't need special libraries, JScript is installed. However,
you might need to specify on your pages that JScript should be used
instead of VBScript. To do this, place this line on top of the ASP page:

<%@ Language=JavaScript %>

This should be the first line of the page.

I tried this command and it does not seem to work.

var fileSys;
var txtFile;
fileSys = new ActiveXObject("Scripting.FileSystemObject");
txtFile = fileSys.OpenTextFile("./junk.txt",1,false);
I don't find a OpenTextFile method for the FileSysteObject.

Do you mean:
txtFile = fileSys.CreateTextFile( "c:\\testfile.txt", true );

Note the windows notation (backslash as path separator instead of slash)!!

More documentation about the FileSystemObject: See MSDN
<URL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/sgfsosample.asp>
I can't find examples on the web. What would I search for to find out
about objects the Scripting.FileSystemObject?

Background
I work at a large company with a corperate IT group.
I need to write some server side scripts. The servers they
have are Windows 2000 with IIS installed. If additional
software needs to be installed I will be forced to use VBscript.

Bill


That would be a shame ;-)

HTH,

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #2
Bill Sneddon wrote:
Does Javascript work "out of the box with IIS" as an
Active server page? ie. does it have the ability to open files
ect.?
JScript does, yes.

I tried this command and it does not seem to work.
"Does not seem to work" is about as vague as you can get. Blank page?
Browser hang? Error message? Source shown? Every molecule in your body
exploding at the speed of light?

var fileSys;
Only code within <% %> blocks is processed on the server.

var txtFile;
fileSys = new ActiveXObject("Scripting.FileSystemObject");
txtFile = fileSys.OpenTextFile("./junk.txt",1,false);

I can't find examples on the web. What would I search for to find out
about objects the Scripting.FileSystemObject?

[snip]

It's a normal COM object. Just look at the (numerous) VBScript examples and
adapt it to JScript syntax.
-
Jim Dabell

Jul 20 '05 #3
On Wed, 03 Sep 2003 22:58:16 +0200, "Laurent Bugnion, GalaSoft"
<galasoft-LB@bluewin_NO_SPAM.ch> wrote:
Hi,

Bill Sneddon wrote:
I tried this command and it does not seem to work.

var fileSys;
var txtFile;
fileSys = new ActiveXObject("Scripting.FileSystemObject");
txtFile = fileSys.OpenTextFile("./junk.txt",1,false);


I don't find a OpenTextFile method for the FileSysteObject.


It's there.

FSO works with real files, not URLs, so use Server.MapPath to get the
path to the file on your filesystem.

txtFile = fileSys.OpenTextFile(Server.MapPath(".") + "\\junk.txt",
1, false);
Note the windows notation (backslash as path separator instead of slash)!!

More documentation about the FileSystemObject: See MSDN
<URL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/sgfsosample.asp>


Regards,
Steve
Jul 20 '05 #4
Hi,

Steve van Dongen wrote:
On Wed, 03 Sep 2003 22:58:16 +0200, "Laurent Bugnion, GalaSoft"
<galasoft-LB@bluewin_NO_SPAM.ch> wrote:

I don't find a OpenTextFile method for the FileSysteObject.

It's there.


I believe you alright ;-) I checked it up in MSDN quite late last night,
and was aware that my unability to find it in the MSDN jungle didn't
mean it was not there ;-)

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #5
Thanks All.

It is working now. I think my problem was related to the path.
As Steve suggested.

Thanks again ... glad I don't have to use VB script!!

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil | last post by:
I am using a Pascal like language (Wealth-Lab) on W2K and call this server: class HelloWorld: _reg_clsid_ = "{4E797C6A-5969-402F-8101-9C95453CF8F6}" _reg_desc_ = "Python Test COM Server"...
6
by: Nathan Sokalski | last post by:
I want to set up SQL Server on Windows XP Pro so that I can use the database capabilities of ASP and IIS. I am probably using some incorrect settings, but I am not sure what they are. Here is what...
9
by: Grim Reaper | last post by:
My work let me put SQL Server 7.0 Enterprise Edition on my laptop. I have never setup a server from the beginning, so I am a little new at creating server groups. Alright, I am trying to create...
0
by: Chris Halcrow | last post by:
Hi I've spent ALL DAY trying to re-install SQL Server 2000 on Windows XP. I continually get the error 'cannot configure server' just at the end of the installation. I've tried the following: ...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
22
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to...
2
by: Mike | last post by:
Hi, I am strugling with a simple problem which I can't seem to resolve. I have an asp.net page which contains a server-control (flytreeview, which is a kind of a tree to be exact). The tree is...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
14
by: Developer | last post by:
Hello All, i have recently installed VS2005 and was trying to install SQL sever 2000. I have Win XP' SP2. But when I tried installing, it only installed client tools and not the database. Can...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.