Check file date of text file

Discussion in 'ASP General' started by mbosco51@hotmail.com, Mar 28, 2005.

  1. Guest

    Hi. I am tring to setup an asp script that will do the following...

    If file date/time is within last 10 minutes then
    response.redirect to file
    else
    do something else
    end if

    The text file is not located on the webserver. I created a virtual
    directory on the webserver which allows me to response.redirect to the
    file. However when I use the FileSystemObject to check the date/time,
    I cannot find the file. It seems like it only works against files on
    the webserver. UNC paths do not seem to work. I was hoping the
    virtual directory would allow me to specify something like
    c:\inetpub\wwwroot\<VIRTUAL DIR NAME>\<FILE NAME>, however that's not
    working either.

    Basically, is there any way to use FileSystemObject against a file not
    on the webserver, or can I get the file date/time using something else?

    Thanks.
     
    , Mar 28, 2005
    #1
    1. Advertising

  2. Mark Guest

    Have you tried mapping the network drive? I can understand FileSystemObject
    not working on unc paths, but perhaps it would have more luck if you map the
    drive and use a more regular path structure?

    -Mark


    "" wrote:

    > Hi. I am tring to setup an asp script that will do the following...
    >
    > If file date/time is within last 10 minutes then
    > response.redirect to file
    > else
    > do something else
    > end if
    >
    > The text file is not located on the webserver. I created a virtual
    > directory on the webserver which allows me to response.redirect to the
    > file. However when I use the FileSystemObject to check the date/time,
    > I cannot find the file. It seems like it only works against files on
    > the webserver. UNC paths do not seem to work. I was hoping the
    > virtual directory would allow me to specify something like
    > c:\inetpub\wwwroot\<VIRTUAL DIR NAME>\<FILE NAME>, however that's not
    > working either.
    >
    > Basically, is there any way to use FileSystemObject against a file not
    > on the webserver, or can I get the file date/time using something else?
    >
    > Thanks.
    >
    >
     
    Mark, Mar 28, 2005
    #2
    1. Advertising

  3. What is the code that you're using now? And when you say UNC paths don't
    work, what do you mean? Do you get an error? What does it say? Are you
    using the default local IUSR account for your site, or a domain account that
    has NTFS and share permissions to these UNC paths?

    Ray at work

    <> wrote in message
    news:...
    > Hi. I am tring to setup an asp script that will do the following...
    >
    > If file date/time is within last 10 minutes then
    > response.redirect to file
    > else
    > do something else
    > end if
    >
    > The text file is not located on the webserver. I created a virtual
    > directory on the webserver which allows me to response.redirect to the
    > file. However when I use the FileSystemObject to check the date/time,
    > I cannot find the file. It seems like it only works against files on
    > the webserver. UNC paths do not seem to work. I was hoping the
    > virtual directory would allow me to specify something like
    > c:\inetpub\wwwroot\<VIRTUAL DIR NAME>\<FILE NAME>, however that's not
    > working either.
    >
    > Basically, is there any way to use FileSystemObject against a file not
    > on the webserver, or can I get the file date/time using something else?
    >
    > Thanks.
    >
     
    Ray Costanzo [MVP], Mar 28, 2005
    #3
  4. Guest

    This is a production web server, so I'm not sure if I have the rights
    to get a permanent mapped drive. Here's the code...

    'path of the text file
    FilePath = "c:\inetpub\wwwroot\test.txt"
    Set File = server.CreateObject("Scripting.FileSystemObject")

    'checking that the file exist
    If (File.FileExists(FilePath)) Then
    Response.Write "File Found"
    else
    Response.Write "Not Found"
    end if

    This works fine, but if I set it to a path on the server that really
    holds the file...
    \\servername\sharename\test.txt
    I always get a File Not Found message, even though I know it exists.
    The website is running under the default IUSR account. I'm assuming
    it's failing because it doesn't have access to view the path in
    question. Is it possible to get access for the local IS account on the
    file server?
     
    , Mar 29, 2005
    #4
  5. Yes, I agree. That is most likely your issue. Take a look at
    http://www.aspfaq.com/show.asp?id=2168 in the "If the file is within your
    LAN" section.

    Ray at work

    <> wrote in message
    news:...
    > if I set it to a path on the server that really
    > holds the file...
    > \\servername\sharename\test.txt
    > I always get a File Not Found message, even though I know it exists.
    > The website is running under the default IUSR account. I'm assuming
    > it's failing because it doesn't have access to view the path in
    > question. Is it possible to get access for the local IS account on the
    > file server?
    >
     
    Ray Costanzo [MVP], Mar 29, 2005
    #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. Matt
    Replies:
    1
    Views:
    631
    Matthew Speed
    Nov 8, 2003
  2. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,326
    Michael Borgwardt
    May 30, 2004
  3. Matt
    Replies:
    2
    Views:
    548
    Pete Becker
    Nov 8, 2003
  4. Matt
    Replies:
    3
    Views:
    744
    Richard Heathfield
    Nov 8, 2003
  5. user
    Replies:
    41
    Views:
    370
    Dr J R Stockton
    Dec 2, 2006
Loading...

Share This Page