473,480 Members | 1,498 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

URL checking

EMW
Hi,

My ASPX (vb.NET) page needs to check an URL.
if it exists then it shows the picture (url is to that picture)
if is doesn't exist, it must show another picture.

but the question is how do I know wheater the URL is valid?

I use a Image webcontrol and that doesn't let me know the picture cannot be
found, it just shows the red x.

rg.
Eric
Nov 19 '05 #1
2 2131
If these images are locale to your machine, you could probably just use the
File.Exist method to determine if that file exists. If these are remote
images, then you will have to use the HttpWebRequest/HttpWebResponse to try
to download the image. If the response is something like a 404, then you
can swap in your substitute image.

"EMW" <so*****@MikroZoft.com> wrote in message
news:41**********************@dreader2.news.tiscal i.nl...
Hi,

My ASPX (vb.NET) page needs to check an URL.
if it exists then it shows the picture (url is to that picture)
if is doesn't exist, it must show another picture.

but the question is how do I know wheater the URL is valid?

I use a Image webcontrol and that doesn't let me know the picture cannot be found, it just shows the red x.

rg.
Eric

Nov 19 '05 #2
Using Peter's technique, you could also make a nice site-wide solution using
an HttpModule (or an HttpHandler). There, you would determine if the file
is an image request (.jpg, .jpeg, .gif, .png, .bmp, etc.), and use
System.IO.File.Exist () to determine whether the file is real. If not, you
can Rewrite the Url to point at your placeholder file.

An alternate possibility is to just database the list of photos, and check
there first.

/// M

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:#W**************@TK2MSFTNGP11.phx.gbl...
If these images are locale to your machine, you could probably just use the File.Exist method to determine if that file exists. If these are remote
images, then you will have to use the HttpWebRequest/HttpWebResponse to try to download the image. If the response is something like a 404, then you
can swap in your substitute image.

"EMW" <so*****@MikroZoft.com> wrote in message
news:41**********************@dreader2.news.tiscal i.nl...
Hi,

My ASPX (vb.NET) page needs to check an URL.
if it exists then it shows the picture (url is to that picture)
if is doesn't exist, it must show another picture.

but the question is how do I know wheater the URL is valid?

I use a Image webcontrol and that doesn't let me know the picture cannot

be
found, it just shows the red x.

rg.
Eric


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2682
by: Ville Mattila | last post by:
Hello readers, I'm trying to install the latest PHP4 version from the scratch. The configure string is following: ../configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-curl...
7
7547
by: - ions | last post by:
I have created a JComboBox with its Items as a list of "M" numbers ie. M1,M2,M3.......throgh too M110 (thes are the messier objects, a catolouge of deep sky objects) the user selects of of these...
5
2978
by: Tongu? Yumruk | last post by:
I have a little proposal about type checking in python. I'll be glad if you read and comment on it. Sorry for my bad english (I'm not a native English speaker) A Little Stricter Typing in Python...
6
14295
by: Web Developer | last post by:
Hi, I come across the term "type checking" very often in my readings on C++, and have never heard it in Java. Besides the simplistic answer that it checks the "type", what more does it mean? ...
22
4861
by: Qopit | last post by:
Hi there, I'm pretty new to Python and am trying to figure out how to get "will this code compile?"-like code checking. To me this is a pretty basic language/environment requirement, especially...
4
2330
by: Patient Guy | last post by:
Does anyone have any coding rules they follow when doing argument checking? When arguments fail during check, do you return from the call with an ambiguous return value, or do you throw...
16
2586
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
125
6464
by: jacob navia | last post by:
We hear very often in this discussion group that bounds checking, or safety tests are too expensive to be used in C. Several researchers of UCSD have published an interesting paper about this...
7
2604
by: polas | last post by:
Afternoon everyone. I have a quick question about standard C. Generally speaking, in my experience, whenever one accesses an array there is never any bounds checking done (either statically...
4
2937
by: BillE | last post by:
I have found articles on line about using word interop for spell checking with visual studio applications. Most of the articles are several years old, though - VS2003, maybe 2005. I couldn't...
0
7044
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7045
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7087
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.