This answer isn't quite what Mark asked about. 

If you were checking for local files the below code looks right (I just
glimpsed at it).

However if you are trying to display images from sql server then a few
questions:

1) Is this your sql server? Probably not based on your question.. If so
then something like select field from table where pictureid =
@picturedid.

2) If this is another site then do you have permission to link to their
images? If not maybe that's WHY their image urls are changing
continually.  If you do have permission then you could do a HTTP request
on the server before serving the page - but that's generally a bad idea
as it causes a potential delay in the server side processing of your
page.

You could probably do something in javascript client side to verify the
image, and if not found then fetch an image from your site.  I don't
have any code to do this, but you could take an image prefetch script
and I think you could modify it without a lot of work - however I
haven't tried this, so I may be wrong (my expertise is server side, not
javascript).

Hopefully that helps some,

Steve Radich - http://www.aspdeveloper.net - Virtual Server FAQ -
ASP.Net Information - FREE
BitShop, Inc. - http://www.bitshop.com - Managed Servers, Colocation,
.Net Development (C#,VB,ASP)


-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Friday, May 20, 2005 9:36 PM
To: [email protected]
Subject: Re: [AspNetAnyQuestionIsOk] OT - check for broken images from
other sites


Use the System.IO.File.Exists() Method


Imports System
Imports System.IO
Imports System.Text

Public Class Test
    Public Shared Sub Main()
        Dim path As String = "c:\temp\MyTest.txt"
        Dim path2 As String = path + "temp"
        Try
            Dim sw As StreamWriter = File.CreateText(path)
            sw.Close()
            ' Do the Copy operation only if the first file exists
            ' and the second file does not.
            If File.Exists(path) Then
                If File.Exists(path2) Then
                    Console.WriteLine("The target file already exists.")
                Else
                    'try to copy it
                    File.Copy(path, path2)
                    Console.WriteLine("{0} was copied to {1}.", path,
path2)
                End If
            Else
                Console.WriteLine("The source file does not exist.")
            End If
        Catch e As Exception
            Console.WriteLine("The process failed: {0}", e.ToString())
        End Try
    End Sub
End Class












Quoting Mark E <[EMAIL PROTECTED]>:

> All,
> 
> I have a site that displays images on home builder
> sites.  The links to these images are stored in SQL
> Server.
> 
> Apparently they move/delete/rename their images some
> what often and I am left with a broken image.
> 
> Is there a way to check for this and display one of
> those "No Image Available" images in its place?
> 
> Thanks,
> Mark
> 
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 




 
Yahoo! Groups Links



 






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to