homepage Welcome to WebmasterWorld Guest from 54.227.171.163
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
Deal with Image not Found
Need classic ASP code
iloveu

5+ Year Member



 
Msg#: 3157 posted 2:41 am on Dec 14, 2005 (gmt 0)

I run a site with classic ASP. One situation is: when a visitor clicks a page with broken image link (no image file at all), the ASP code is able to detect it, and display a "Picture Not Found" or "Picture coming soon" image instead.

Like:

IF the picture not exists THEN
disply a image of "Picture coming soon"
ELSE
'just show the picture
EMD IF

Do you know how to write this code with classic ASP?

 

Krapulator

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3157 posted 1:35 am on Dec 15, 2005 (gmt 0)

A possible solution would be to create an ASP page which displays an image based on a url parameter.

EG something like:

view-image.asp?url=/images/whatever.jpg

then in the code on your view-image.asp page, you could use the filesystem object to test whether the image exists on the server and then show it if it exists and show an alternate if it doesn't.

duckhunter

10+ Year Member



 
Msg#: 3157 posted 3:58 pm on Dec 16, 2005 (gmt 0)

Use the XMLHttp object to open the image's URL. If object.status = 200, it's there.

(Kinda expensive operation to do everytime someone hits the page tho)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved