Re: check if image or file exists
- From: mboizeau@xxxxxxx (oraclevsmicrosoft)
- Date: 23 Jun 2005 05:33:09 -0700
This sounds good, but if the URI is incorect this will throw an
exception. You should use a "try catch" structure to return a
boolean.
Here is a sample code close to your problem :
http://oraclevsmicrosoft.blogspot.com/2005/06/web-crawlerregular-expressions-and.html
(look for the "loadUrl" method)
Hope this helps
Marc Boizeau
http://oraclevsmicrosoft.blogspot.com
"=?Utf-8?B?SGFyb2xkcw==?=" <Harolds@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:<6B638233-5CFB-448C-A7CC-019D5469828F@xxxxxxxxxxxxx>...
> Not tested but you could try something like this:
>
> Dim objResponse As Net.HttpWebResponse
> Dim objRequest As Net.HttpWebRequest = Net.WebRequest.Create(URL)
> objRequest.Method = "GET"
> objResponse = objRequest.GetResponse()
>
>
> "Filip De Backer" wrote:
>
> > Hi everyone,
> >
> > I want to check if a certain file or image exists.
> > The picture exists when I use th eurl in my IE, but in my C# code, the if
> > statement returns false.
> > Is there another way to do this?
> >
> > string PictureUrl =
> > "http://www.lessius-ho.be/webapp/personeelsindex/images/543.jpg";
> > if (File.Exists(PictureUrl))
> > {
> > imgFotoPersoon.ImageUrl = PictureUrl;
> > imgFotoPersoon.Visible = true;
> > }
> > else
> > {
> > imgFotoPersoon.Visible = false;
> > }
> >
> > thanks in advance,
> >
> > Filip De Backer
.
- References:
- check if image or file exists
- From: Filip De Backer
- RE: check if image or file exists
- From: Harolds
- check if image or file exists
- Prev by Date: RE: Implicit conversion from one object to another
- Next by Date: javascript and controls in multipages/tabastrip
- Previous by thread: RE: check if image or file exists
- Next by thread: List'o MyProj CSS Elements?
- Index(es):
Relevant Pages
|