reading text file

Discussion in 'ASP General' started by dave, Apr 23, 2004.

  1. dave

    dave Guest

    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
     
    dave, Apr 23, 2004
    #1
    1. Advertising

  2. dave

    Armando Guest

    > 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

    "dave" <> wrote in message
    news:300f01c428c6$bfddb430$...
    > 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
     
    Armando, Apr 23, 2004
    #2
    1. Advertising

  3. dave

    dave Guest

    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
    >
    >"dave" <> wrote in

    message
    >news:300f01c428c6$bfddb430$...
    >> 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

    >
    >
    >.
    >
     
    dave, Apr 23, 2004
    #3
  4. dave

    Armando Guest

    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

    "dave" <> wrote in message
    news:2fe201c428d7$810e6360$...
    > 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
    > >
    > >"dave" <> wrote in

    > message
    > >news:300f01c428c6$bfddb430$...
    > >> 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

    > >
    > >
    > >.
    > >
     
    Armando, Apr 23, 2004
    #4
  5. dave

    rwg Guest

    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" <>
    | References: <300f01c428c6$bfddb430$> <#> <2fe201c428d7$810e6360
    $>
    | 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
    |
    | "dave" <> wrote in message
    | news:2fe201c428d7$810e6360$...
    | > 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
    | > >
    | > >"dave" <> wrote in
    | > message
    | > >news:300f01c428c6$bfddb430$...
    | > >> 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
    | > >
    | > >
    | > >.
    | > >
    |
    |
    |
     
    rwg, Apr 24, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darrel
    Replies:
    3
    Views:
    699
    Kevin Spencer
    Nov 11, 2004
  2. Replies:
    0
    Views:
    807
  3. Replies:
    1
    Views:
    468
    Keith Thompson
    Apr 12, 2005
  4. Lionel
    Replies:
    22
    Views:
    679
    Steve Holden
    Feb 3, 2009
  5. Robin Wenger
    Replies:
    191
    Views:
    3,314
Loading...

Share This Page