MS XML HTTP REQUEST AND PATHS

Discussion in 'ASP General' started by vunet.us@gmail.com, Apr 11, 2007.

  1. Guest

    Why ASP's MS XML HTTP request object gets another page's HTML source
    without interpreting path differences. For example, if my page is:

    www.test.asp/one/two/page1.asp

    with XMLHTTP getting source code of page:

    www.test.asp/one/page2.asp

    and this latter page has a CSS with path ../include/css.css, it won't
    be used in page1.asp because path will stay as it is "../include/
    css.css", not "../../include/css.css" as needed for page1.asp?

    So I only have one workaround to replace instances of ../ with ../../.
    Any other suggestions or explanations?
    Thank you
     
    , Apr 11, 2007
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > Why ASP's MS XML HTTP request object gets another page's HTML source
    > without interpreting path differences. For example, if my page is:
    >
    > www.test.asp/one/two/page1.asp
    >
    > with XMLHTTP getting source code of page:
    >
    > www.test.asp/one/page2.asp
    >
    > and this latter page has a CSS with path ../include/css.css, it won't
    > be used in page1.asp because path will stay as it is "../include/
    > css.css", not "../../include/css.css" as needed for page1.asp?
    >
    > So I only have one workaround to replace instances of ../ with ../../.
    > Any other suggestions or explanations?
    > Thank you
    >


    I don't like to use ../ at all, as it restricts mobility.
    I always use a absolute path like /include/css.css

    Do this and you will not have the problem
     
    ThatsIT.net.au, Apr 11, 2007
    #2
    1. Advertising

  3. <> wrote in message
    news:...
    > Why ASP's MS XML HTTP request object gets another page's HTML source
    > without interpreting path differences. For example, if my page is:
    >
    > www.test.asp/one/two/page1.asp
    >
    > with XMLHTTP getting source code of page:
    >
    > www.test.asp/one/page2.asp
    >
    > and this latter page has a CSS with path ../include/css.css, it won't
    > be used in page1.asp because path will stay as it is "../include/
    > css.css", not "../../include/css.css" as needed for page1.asp?


    I assume you're talking about LINK tags in an HTML doc, that reference CSS
    in an external file, (as opposed to a server-side #include) correct? Those
    tags are interpreted by the browser, XMLHTTP doesn't interpret anything that
    can't be parsed as well-formed XML, you are using it to download raw HTML
    source, that was intended to be browsed from within the context of a given
    web path.

    This actually applies to any tag that has an href, src, action, or any other
    attribute that the browser resolves to a URL. Any relative aspects of
    referenced URLs will be resolved based upon the FQ URL of the document being
    browsed, by the client browser.

    Content acquired using XMLHTTP will have no reference to the location from
    which it was originally acquired, to do it right, you'd need to resolve all
    relative URLs to be fully-qualified, based on the location from which the
    content was originally served.


    -Mark


    > So I only have one workaround to replace instances of ../ with ../../.
    > Any other suggestions or explanations?
    > Thank you
    >
     
    Mark J. McGinty, Apr 11, 2007
    #3
    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. Brian Birtle
    Replies:
    2
    Views:
    2,036
    John Saunders
    Oct 16, 2003
  2. Noah
    Replies:
    5
    Views:
    786
  3. nRk
    Replies:
    1
    Views:
    1,000
    Steven D'Aprano
    Feb 12, 2009
  4. Ohad Lutzky

    Paths, gentleman, paths

    Ohad Lutzky, Nov 6, 2006, in forum: Ruby
    Replies:
    2
    Views:
    197
    David Vallner
    Nov 7, 2006
  5. Gelonida N
    Replies:
    0
    Views:
    529
    Gelonida N
    Feb 27, 2012
Loading...

Share This Page