OK, this is what I have so far, but...it only works
when the image is found. If the image does NOT exist,
I get a 404 error. Now, I know I can trap this with a
Try statement, but that doesn't seem like an effecient
way to do to it.
Anyhow, here's my code thus far:
Dim objResponse As WebResponse
Dim objRequest As WebRequest
Dim strResult As String
objRequest =
System.Net.HttpWebRequest.Create("http://www.wsfsbank.com/images/Home_Business6.jpg")
objResponse = objRequest.GetResponse()
Dim objStreamReader As New
StreamReader(objResponse.GetResponseStream())
strResult = objStreamReader.ReadToEnd()
If strResult.Length = 0 Then
Response.Write("NO image found")
Else
Response.Write("FOUND THE image")
End If
Is there a better way to do this w/o using trying to
trap the error?
Thanks,
Mark
--- Charles Carroll <[EMAIL PROTECTED]> wrote:
> There are several ways
>
> You can scan their site withe a regex for img src
> and then do a HTTP
> request for the image. Look up the webrequest object
> that does the
> lifting there and we can help you use it.
>
> On 5/20/05, Mark E <[EMAIL PROTECTED]> wrote:
> > 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
> >
> >
> > 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 the Yahoo!
> Terms of Service.
>
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/