Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Verifying a URL

Reply
Thread Tools

Verifying a URL

 
 
julian
Guest
Posts: n/a
 
      07-17-2003
Hi,

I have situation where I want to use a stylesheet stored
in one of two possible urls. Basically I need to say if
the first url doesn't exist, use the second url.

I can do this by creating a WebRequest and intercepting
the exception raised by the GetResponse if the first url
doesn't exisit, but this feels like a hack to me and I was
hoping there would be some simple way (similar to
File.Exists) to check whether a url refered to a file that
was actually there?

Any help would be appreciated.

Thanks.
 
Reply With Quote
 
 
 
 
Mario Vargas
Guest
Posts: n/a
 
      07-17-2003
Actually, before I finished reading your post I thought about telling you to
use the WebRequest class. I think you are on the right track, but you might
want to consider caching the URL so that it's not done for every request to
your web form.

Mario

"julian" <(E-Mail Removed)> wrote in message
news:087b01c34c61$3c6a3d40$(E-Mail Removed)...
> Hi,
>
> I have situation where I want to use a stylesheet stored
> in one of two possible urls. Basically I need to say if
> the first url doesn't exist, use the second url.
>
> I can do this by creating a WebRequest and intercepting
> the exception raised by the GetResponse if the first url
> doesn't exisit, but this feels like a hack to me and I was
> hoping there would be some simple way (similar to
> File.Exists) to check whether a url refered to a file that
> was actually there?
>
> Any help would be appreciated.
>
> Thanks.



 
Reply With Quote
 
 
 
 
julian
Guest
Posts: n/a
 
      07-17-2003
Thanks for the responses. I guess I will leave it the way
it is then - it certainly works. I just feel a bit
guilty / lazy to be using Exceptions to handle an expected
condition (i.e. not an error).


>-----Original Message-----
>Hi,
>
>I have situation where I want to use a stylesheet stored
>in one of two possible urls. Basically I need to say if
>the first url doesn't exist, use the second url.
>
>I can do this by creating a WebRequest and intercepting
>the exception raised by the GetResponse if the first url
>doesn't exisit, but this feels like a hack to me and I

was
>hoping there would be some simple way (similar to
>File.Exists) to check whether a url refered to a file

that
>was actually there?
>
>Any help would be appreciated.
>
>Thanks.
>.
>

 
Reply With Quote
 
Mario Vargas
Guest
Posts: n/a
 
      07-17-2003
Actually, that's why structured exception handling was created. You catch an
exception to recover from it. That's how your applications come become
"smarter." They learn from their mistakes, he he.

Mario

"julian" <(E-Mail Removed)> wrote in message
news:00d501c34c75$a38fc9e0$(E-Mail Removed)...
> Thanks for the responses. I guess I will leave it the way
> it is then - it certainly works. I just feel a bit
> guilty / lazy to be using Exceptions to handle an expected
> condition (i.e. not an error).
>
>
> >-----Original Message-----
> >Hi,
> >
> >I have situation where I want to use a stylesheet stored
> >in one of two possible urls. Basically I need to say if
> >the first url doesn't exist, use the second url.
> >
> >I can do this by creating a WebRequest and intercepting
> >the exception raised by the GetResponse if the first url
> >doesn't exisit, but this feels like a hack to me and I

> was
> >hoping there would be some simple way (similar to
> >File.Exists) to check whether a url refered to a file

> that
> >was actually there?
> >
> >Any help would be appreciated.
> >
> >Thanks.
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(extra) parsing (and verifying of) URL's via java.net.URI ... qwertmonkey@syberianoutpost.ru Java 4 10-23-2012 12:34 PM
SOAP example (getting stock price) - verifying endpoint url mirandacascade@yahoo.com Python 1 11-20-2006 07:29 PM
Verifying a link \ url using javascript. Pete Javascript 2 11-28-2004 11:49 AM
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM



Advertisments