what am I doing wrong.....

Discussion in 'ASP General' started by Graham Mattingley, Sep 10, 2003.

  1. Hello

    I have this coden (below), that I found that works really well when to prove
    a URL is valid, or any object in a URL. They way it works is that you submit
    the URL through a form, txtURL is the varable...

    What I want to be able to do is have a database of URLs and loop through
    them with this in the middle and check all the URLs I have on my database..

    so I did

    txtURL=rsIslandinfo("URL").Value --- (my database varable)

    the whole page loads in about 2 seconds, and all the URL have tested as
    invalid, I suspect the value txtURL is not being applyed to the XMLHTTP
    object..

    any ideas, I wanted to test my database of links are up to date

    Regards

    Graham Mattingley



    if len(trim(Request("txtURL"))) > 0 then
    iStatus = 0
    sURL = trim(Request("txtURL"))
    'Set obj = CreateObject("Microsoft.XMLHTTP")
    Set obj = CreateObject("MSXML2.XMLHTTP.4.0")
    on error resume next
    obj.open "GET", sURL, False
    obj.send
    if err.number = 0 then
    iStatus = obj.Status
    end if
    on error goto 0

    if iStatus = 200 then
    Response.write "<p>The URL is valid, status is " & iStatus & "</p>" & vbCRLF
    else
    Response.write "<p>The URL is invalid, status is " & iStatus & "</p>" &
    vbCRLF
    end if
    end if
    Graham Mattingley, Sep 10, 2003
    #1
    1. Advertising

  2. Graham Mattingley

    Tom B Guest

    What value do you get for iStatus?
    "Graham Mattingley" <> wrote in message
    news:bjo6nq$2cq$1$...
    > Hello
    >
    > I have this coden (below), that I found that works really well when to

    prove
    > a URL is valid, or any object in a URL. They way it works is that you

    submit
    > the URL through a form, txtURL is the varable...
    >
    > What I want to be able to do is have a database of URLs and loop through
    > them with this in the middle and check all the URLs I have on my

    database..
    >
    > so I did
    >
    > txtURL=rsIslandinfo("URL").Value --- (my database varable)
    >
    > the whole page loads in about 2 seconds, and all the URL have tested as
    > invalid, I suspect the value txtURL is not being applyed to the XMLHTTP
    > object..
    >
    > any ideas, I wanted to test my database of links are up to date
    >
    > Regards
    >
    > Graham Mattingley
    >
    >
    >
    > if len(trim(Request("txtURL"))) > 0 then
    > iStatus = 0
    > sURL = trim(Request("txtURL"))
    > 'Set obj = CreateObject("Microsoft.XMLHTTP")
    > Set obj = CreateObject("MSXML2.XMLHTTP.4.0")
    > on error resume next
    > obj.open "GET", sURL, False
    > obj.send
    > if err.number = 0 then
    > iStatus = obj.Status
    > end if
    > on error goto 0
    >
    > if iStatus = 200 then
    > Response.write "<p>The URL is valid, status is " & iStatus & "</p>" &

    vbCRLF
    > else
    > Response.write "<p>The URL is invalid, status is " & iStatus & "</p>" &
    > vbCRLF
    > end if
    > end if
    >
    >
    >
    Tom B, Sep 11, 2003
    #2
    1. Advertising

  3. Graham Mattingley

    Curt_C [MVP] Guest

    this is what I use to validate a URL
    http://www.darkfalz.com/1046


    --
    ----------------------------------------------------------
    Curt Christianson (Software_AT_Darkfalz.Com)
    Owner/Lead Designer, DF-Software
    http://www.Darkfalz.com
    ---------------------------------------------------------
    ...Offering free scripts & code snippits for everyone...
    ---------------------------------------------------------


    "Graham Mattingley" <> wrote in message
    news:bjo6nq$2cq$1$...
    > Hello
    >
    > I have this coden (below), that I found that works really well when to

    prove
    > a URL is valid, or any object in a URL. They way it works is that you

    submit
    > the URL through a form, txtURL is the varable...
    >
    > What I want to be able to do is have a database of URLs and loop through
    > them with this in the middle and check all the URLs I have on my

    database..
    >
    > so I did
    >
    > txtURL=rsIslandinfo("URL").Value --- (my database varable)
    >
    > the whole page loads in about 2 seconds, and all the URL have tested as
    > invalid, I suspect the value txtURL is not being applyed to the XMLHTTP
    > object..
    >
    > any ideas, I wanted to test my database of links are up to date
    >
    > Regards
    >
    > Graham Mattingley
    >
    >
    >
    > if len(trim(Request("txtURL"))) > 0 then
    > iStatus = 0
    > sURL = trim(Request("txtURL"))
    > 'Set obj = CreateObject("Microsoft.XMLHTTP")
    > Set obj = CreateObject("MSXML2.XMLHTTP.4.0")
    > on error resume next
    > obj.open "GET", sURL, False
    > obj.send
    > if err.number = 0 then
    > iStatus = obj.Status
    > end if
    > on error goto 0
    >
    > if iStatus = 200 then
    > Response.write "<p>The URL is valid, status is " & iStatus & "</p>" &

    vbCRLF
    > else
    > Response.write "<p>The URL is invalid, status is " & iStatus & "</p>" &
    > vbCRLF
    > end if
    > end if
    >
    >
    >
    Curt_C [MVP], Sep 11, 2003
    #3
  4. I get Value 0


    "Tom B" <> wrote in message
    news:uyShhF$...
    > What value do you get for iStatus?
    > "Graham Mattingley" <> wrote in message
    > news:bjo6nq$2cq$1$...
    > > Hello
    > >
    > > I have this coden (below), that I found that works really well when to

    > prove
    > > a URL is valid, or any object in a URL. They way it works is that you

    > submit
    > > the URL through a form, txtURL is the varable...
    > >
    > > What I want to be able to do is have a database of URLs and loop through
    > > them with this in the middle and check all the URLs I have on my

    > database..
    > >
    > > so I did
    > >
    > > txtURL=rsIslandinfo("URL").Value --- (my database varable)
    > >
    > > the whole page loads in about 2 seconds, and all the URL have tested as
    > > invalid, I suspect the value txtURL is not being applyed to the XMLHTTP
    > > object..
    > >
    > > any ideas, I wanted to test my database of links are up to date
    > >
    > > Regards
    > >
    > > Graham Mattingley
    > >
    > >
    > >
    > > if len(trim(Request("txtURL"))) > 0 then
    > > iStatus = 0
    > > sURL = trim(Request("txtURL"))
    > > 'Set obj = CreateObject("Microsoft.XMLHTTP")
    > > Set obj = CreateObject("MSXML2.XMLHTTP.4.0")
    > > on error resume next
    > > obj.open "GET", sURL, False
    > > obj.send
    > > if err.number = 0 then
    > > iStatus = obj.Status
    > > end if
    > > on error goto 0
    > >
    > > if iStatus = 200 then
    > > Response.write "<p>The URL is valid, status is " & iStatus & "</p>" &

    > vbCRLF
    > > else
    > > Response.write "<p>The URL is invalid, status is " & iStatus & "</p>" &
    > > vbCRLF
    > > end if
    > > end if
    > >
    > >
    > >

    >
    >
    Graham Mattingley, Sep 11, 2003
    #4
  5. Graham Mattingley

    Tom B Guest

    Try taking out your on error resume next.
    You have an if statement that's keeping iStatus from getting a value.

    "Graham Mattingley" <> wrote in message
    news:bjovl0$h33$1$...
    > I get Value 0
    >
    >
    > "Tom B" <> wrote in message
    > news:uyShhF$...
    > > What value do you get for iStatus?
    > > "Graham Mattingley" <> wrote in message
    > > news:bjo6nq$2cq$1$...
    > > > Hello
    > > >
    > > > I have this coden (below), that I found that works really well when to

    > > prove
    > > > a URL is valid, or any object in a URL. They way it works is that you

    > > submit
    > > > the URL through a form, txtURL is the varable...
    > > >
    > > > What I want to be able to do is have a database of URLs and loop

    through
    > > > them with this in the middle and check all the URLs I have on my

    > > database..
    > > >
    > > > so I did
    > > >
    > > > txtURL=rsIslandinfo("URL").Value --- (my database varable)
    > > >
    > > > the whole page loads in about 2 seconds, and all the URL have tested

    as
    > > > invalid, I suspect the value txtURL is not being applyed to the

    XMLHTTP
    > > > object..
    > > >
    > > > any ideas, I wanted to test my database of links are up to date
    > > >
    > > > Regards
    > > >
    > > > Graham Mattingley
    > > >
    > > >
    > > >
    > > > if len(trim(Request("txtURL"))) > 0 then
    > > > iStatus = 0
    > > > sURL = trim(Request("txtURL"))
    > > > 'Set obj = CreateObject("Microsoft.XMLHTTP")
    > > > Set obj = CreateObject("MSXML2.XMLHTTP.4.0")
    > > > on error resume next
    > > > obj.open "GET", sURL, False
    > > > obj.send
    > > > if err.number = 0 then
    > > > iStatus = obj.Status
    > > > end if
    > > > on error goto 0
    > > >
    > > > if iStatus = 200 then
    > > > Response.write "<p>The URL is valid, status is " & iStatus & "</p>" &

    > > vbCRLF
    > > > else
    > > > Response.write "<p>The URL is invalid, status is " & iStatus & "</p>"

    &
    > > > vbCRLF
    > > > end if
    > > > end if
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
    Tom B, Sep 11, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Salisha Khan
    Replies:
    1
    Views:
    11,651
    JohnFol
    Aug 1, 2003
  2. Keith R. Williams

    What am I doing wrong?

    Keith R. Williams, Jul 14, 2003, in forum: VHDL
    Replies:
    4
    Views:
    1,041
    Ed Diego
    Jul 15, 2003
  3. ed
    Replies:
    1
    Views:
    657
  4. Aaron Ackerman
    Replies:
    2
    Views:
    373
    Lewis Wang [MSFT]
    Jul 29, 2003
  5. J

    What am I doing wrong

    J, Aug 14, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    382
    John Saunders
    Aug 14, 2003
Loading...

Share This Page