#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    8
    Rep Power
    0

    ASP and XML question...


    Hello,

    Good luck on trying to answer this question

    I am working with a Windows server using ASP and I need to write an XML doc to handle virtual directory forwarding working a long with my 404.asp error page. I want to include the XML doc as an include to the 404.asp doc. I donít know how to do it though? I have very little experience with XML.

    This is an example of what I want to do:

    -User types in whatever.com/directory

    -Then IIS sends them to the 404.asp page and the 404.asp page checks with the include XML doc.

    -The XML doc checks to see if whatever.com/directory is a valid virtual directory included within the XML doc and if it is valid it sends them to an assigned URL for that virtual directory. (In other words, the directory isnít a Ďrealí directory it is just a virtual directory that is read and assigned within the XML file which can forward to a specific URL.

    If whatever.com/directory cannot be found within the XML include file the person just stays on the 404.asp error page rather than being forwarded somewhere else.

    Now, what would the XML look like to accomplish something like this? I donít know how to do this

    Short example

    -User types URL: whatever.com/directory
    -404.asp loads and asks: Check XML include file
    -XML include file looks to see if it should send user from whatever.com/directory to a URL.
    -If whatever.com/directory cannot be found in XML the user will stay on the 404.asp error page.


    How do I do this? I am at a loss
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    NJ
    Posts
    428
    Rep Power
    17
    If you want to learn xml then you should get a book and check out w3schools.com and asp101.com. Both sites have a lot of info and tutorials on XML. What you are trying to acheive can easily be done with a dictionary object.

    PHP Code:
      dim dict
      set dict 
    server.createobject("Scripting.dictionary"
    dict.add "OldURL/"dict.add "NewURL"
    dict.add "oldURL2/"dict.add "NewURL2" 
    ...

    referer request.servervariables("HTTP_REFERER")

    ' You'll need to do some string processing here to get to the same level 

    if dict.exists(refererthen 
       response
    .redirect dict(referer)
    end if 
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    8
    Rep Power
    0
    Thank you for the help. I am in the process. I have several books on the way. I just have to get this done and don't have time to learn XML in the timeframe that I need to get this accomplished. Could you maybe explain a little bit what you've done in that bit of code above? So I can get a better idea of how it works?

IMN logo majestic logo threadwatch logo seochat tools logo