Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Verifying a URL

    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.
    julian Guest

  2. Similar Questions and Discussions

    1. Verifying datasources
      Hi, everyone. I didn't write anything for a while. I have an interesting situation here and not sure what causes it and what exactly is the...
    2. Verifying password
      This is so basic it hurts. I have a form asking for name and password. The form sends the data to a CF template which verifies it against a db. ...
    3. Verifying form
      I have a form that I am trying to verify in PHP. If the user incorrectly filled a field, I want the form to redisplay itself with all the submitted...
    4. [PHP] verifying sql INSERTs
      Marek Kilimajer <mailto:kilimajer@webglobe.sk> on Tuesday, August 26, 2003 3:59 AM said: OOhhh... You know, I already HAVE done this, and I...
    5. verifying sql INSERTs
      Hi! (MySQL) What's the best way to determine a sql INSERT statement has executed successfully? What I've got is a function whose sole...
  3. #2

    Default Re: Verifying a URL

    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" <julian.jelfs@strategicthought.com> wrote in message
    news:087b01c34c61$3c6a3d40$a601280a@phx.gbl...
    > 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.

    Mario Vargas Guest

  4. #3

    Default Verifying a URL

    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.
    >.
    >
    julian Guest

  5. #4

    Default Re: Verifying a URL

    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" <julian.jelfs@strategicthought.com> wrote in message
    news:00d501c34c75$a38fc9e0$a101280a@phx.gbl...
    > 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.
    > >.
    > >

    Mario Vargas Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139