Thread: Validate URL

    #1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2002
    Location
    Queensland, Australia
    Posts
    827
    Rep Power
    142

    Validate URL


    I've been given a task to write an function to validate URL's used on a website. The URL's are going to be kept in a table with other fields to indicate if the URL is valid and when it was last validated. Any URL's that aren't valid won't be displayed on the site.

    Is there a way in ASP to check if any given URL returns a 404 error?

    Thanks
  2. #2
  3. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    yes there is a way, but I cant think of it right now....

    would involve setting an if statement to say if pageLoads then insert live into db, if not then insert nothing or dead.... however, this if statement would have to be on every page. There is probably a better way.
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2002
    Location
    Queensland, Australia
    Posts
    827
    Rep Power
    142
    Thanks ralphuk100

    I found what I wanted here http://www.aspalliance.com/damianm/article/9/ but it uses ASP.NET.

    I'm only new to ASP. Can it be done similarly in the current version of ASP.

    I think using an if statemt whenever a link has been used is unavoidable. Using a function won't make this so difficult when presenting many links througout a site.
  6. #4
  7. meester luva luva
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Posts
    2,715
    Rep Power
    25
    No problem DrWorm, Im not even gonna attempt to answer the "can the ASP.net thing be done in classic ASP" as the short answer is I have no idea. I am about to move over to .net in a couple of months so will have a better idea then :-)

IMN logo majestic logo threadwatch logo seochat tools logo