reading text file

D

dave

hi
i have written code to display data frm text located
at C:\test\sample.txt..
it works fine on localhost on local machine (winxp)..
after that i have uploaded on the web server which has
got windows 2003.
i have also checked folder and file properties and given
full right to isur to c:\test\sample.txt on web server..
but when i run the page it says "File not found"
i checked everything but now i m guessing its a issue
with firewall..
can any one suggest how to solve this so i can grab that
file?? how to allow access this folder thru firewall??
all suggestion r welcome...
its my guess that i m not getting this file becoz of
firewall, it can be something else..
below is the code tht i m testing..

Filename = "C:/test/sample.txt"

Dim FSO
set FSO = server.createObject
("Scripting.FileSystemObject")

If FSO.FileExists(Filename) Then
Response.write "File found"
Else
Response.Write "File not found"
End If
Set FSO = nothing

all suggestion would be appreciated...
thanx
dave
 
A

Armando

Filename = "C:/test/sample.txt"

Don't specify physical file paths in your fso object with forward slashes,
use backslashes instead and change this to:

Filename = "C:\test\sample.txt"

Cheers.

Armando
 
D

dave

I tried with backslash but didnt work either..Moreover,
there is no firewall setup on webserver...Gave full
rights IUSR_ to that folder...
still not working...
dave :(
 
A

Armando

instead of using the physical path, can you use a virtual one? (ie;
../test/sample.txt)

Note that if the file is in a completely different area on your disk to use
a virtual path you need to have parent paths enabled for the website.

Armando
 
R

rwg

The userid you are running under needs to have NTFS write acccess to the folder specified. If you are using anonymous on IIS 6 machine, then give
Read, Read&Execute&Write&List rioghts to <computername>\IIS_WPG group for write access to your folder.

-rwg
This is what I think, not necessarily what is accurate!

--------------------
| From: "Armando" <[email protected]>
| References: <[email protected]> <#[email protected]> <2fe201c428d7$810e6360
[email protected]>
| Subject: Re: reading text file
| Date: Fri, 23 Apr 2004 15:33:41 -0500
| Lines: 74
|
| instead of using the physical path, can you use a virtual one? (ie;
| ./test/sample.txt)
|
| Note that if the file is in a completely different area on your disk to use
| a virtual path you need to have parent paths enabled for the website.
|
| Armando
|
| | > I tried with backslash but didnt work either..Moreover,
| > there is no firewall setup on webserver...Gave full
| > rights IUSR_ to that folder...
| > still not working...
| > dave :(
| > >-----Original Message-----
| > >> Filename = "C:/test/sample.txt"
| > >
| > >Don't specify physical file paths in your fso object
| > with forward slashes,
| > >use backslashes instead and change this to:
| > >
| > >Filename = "C:\test\sample.txt"
| > >
| > >Cheers.
| > >
| > >Armando
| > >
| > message
| > >| > >> hi
| > >> i have written code to display data frm text located
| > >> at C:\test\sample.txt..
| > >> it works fine on localhost on local machine (winxp)..
| > >> after that i have uploaded on the web server which has
| > >> got windows 2003.
| > >> i have also checked folder and file properties and
| > given
| > >> full right to isur to c:\test\sample.txt on web
| > server..
| > >> but when i run the page it says "File not found"
| > >> i checked everything but now i m guessing its a issue
| > >> with firewall..
| > >> can any one suggest how to solve this so i can grab
| > that
| > >> file?? how to allow access this folder thru firewall??
| > >> all suggestion r welcome...
| > >> its my guess that i m not getting this file becoz of
| > >> firewall, it can be something else..
| > >> below is the code tht i m testing..
| > >>
| > >> Filename = "C:/test/sample.txt"
| > >>
| > >> Dim FSO
| > >> set FSO = server.createObject
| > >> ("Scripting.FileSystemObject")
| > >>
| > >> If FSO.FileExists(Filename) Then
| > >> Response.write "File found"
| > >> Else
| > >> Response.Write "File not found"
| > >> End If
| > >> Set FSO = nothing
| > >>
| > >> all suggestion would be appreciated...
| > >> thanx
| > >> dave
| > >
| > >
| > >.
| > >
|
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top