MS XML HTTP REQUEST AND PATHS
am 11.04.2007 15:53:01 von vunet.us
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
Re: MS XML HTTP REQUEST AND PATHS
am 11.04.2007 16:49:37 von me
wrote in message
news:1176299581.642483.242140@p77g2000hsh.googlegroups.com.. .
> 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
Re: MS XML HTTP REQUEST AND PATHS
am 11.04.2007 19:00:18 von mmcginty
wrote in message
news:1176299581.642483.242140@p77g2000hsh.googlegroups.com.. .
> 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
>