Problem with MapPath method-need new solution

  • Thread starter Thread starter Steve Simek
  • Start date Start date
S

Steve Simek

All help greatly appreciated.

I have a club site with thousands of pictures. I've used the MapPath method
reliably for the last year to make sure a photo exists before displaying it.

Unfortunately, we've outgrown the storage on site 1 and now need site 2 for
storage.

I've tried using MapPath, but now need to check existence based on full
path. Research seems to indicate that MapPath only works with relative path.

If true, question....

What's the proper way to verify file existence on a different physical site?

TIA
SS
 
-----Original Message-----
What's the proper way to verify file existence on a
different physical site?

Try this. You only need to execute the first statement
once for any nubmer of FileExists tests.

Set fso = CreateObject("Scripting.FileSystemObject")

If (fso.FileExists("myfile.jpg")) Then
'
Else
'
End If

If you mean that the files will exist on a different
server than the Web page, check for existence at a UNC
file location, as in

If (fsp.FileExists("\\myserver\myshare\myfile.jpg")) Then

and be sure to run your application under a domain account
that has network access to the remote server.

Jim Buyens
Microsoft FrontPage MVP
(e-mail address removed)
http://www.interlacken.com
Author of:
*------------------------------------------------------*
|\----------------------------------------------------/|
|| Microsoft Office FrontPage 2003 Inside Out ||
|| Microsoft FrontPage Version 2002 Inside Out ||
|| Web Database Development Step by Step .NET Edition ||
|| Troubleshooting Microsoft FrontPage 2002 ||
|| Faster Smarter Beginning Programming ||
|| (All from Microsoft Press) ||
|/----------------------------------------------------\|
*------------------------------------------------------*
 
I've tried using MapPath, but now need to check existence based on full
path. Research seems to indicate that MapPath only works with relative
path.

Not exactly. Server.MapPath works only within the current Web Application
If true, question....

What's the proper way to verify file existence on a different physical
site?

Using ASP, it is very hard to do. You would have to write a COM object to do
it. Using .Net, it is fairly easy to do. In any case, the method you would
need to use would be to create an HTTP Request to the URL of the image, and
see if you get one back.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.
 
The other server is a different site on the net, not in the same domain (not
even in the same country....)

I need to check existence of a file based on a fully qualified URL.
Hopeless?

SS
 
Are both servers Windows based with IIS and ASP?

If so you might be able do what you want, but it will require writing a
custom ASP based application that will check and server the photo to the
first site.

A better approach would be to have a database on your current site that has
a field, that would indicate if a photo is available before generating a
link to the photo on the second server.

However you will be depending on the second server always being available
(internet backbone, server uptime, etc.)

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
Back
Top