Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Check file date of text file

Reply
Thread Tools

Check file date of text file

 
 
mbosco51@hotmail.com
Guest
Posts: n/a
 
      03-28-2005
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.

 
Reply With Quote
 
 
 
 
Mark
Guest
Posts: n/a
 
      03-28-2005
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


"(E-Mail Removed)" 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.
>
>

 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      03-28-2005
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

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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.
>



 
Reply With Quote
 
mbosco51@hotmail.com
Guest
Posts: n/a
 
      03-29-2005
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?

 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      03-29-2005
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

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> 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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check if one date is later then first date user Javascript 41 12-02-2006 10:10 PM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments