[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

XHR and 12031

Andrew Poulos

8/11/2014 1:46:00 AM

If I make an XHR call to
[server]/projects/test
IIS returns "HTTP/1.1 405 Method Not Allowed" even though I've edited
the handler mappings to allow "all" verbs to file or folder.

All the files are on the same server.

If set IIS to do a URL rewrite to temporarily add a trail slash so that
[server]/projects/test
becomes
[server]/projects/test/
then every browser I test will allow the XHR call to complete (return a
status of 200). Except for IE.

When I check the developer panel in IE 9 the network pane shows the
request as pending until it finally returns 12031.

When I check the developer panel in IE 10 the debug pane shows "access
is denied" when it tries to XHR open
xhr.open(cfg.method, url, async);

If I put the full URL in
xhr.open(cfg.method, "[server]/projects/test/default.asp", async);
then IE allows the XHR call to complete (return a status of 200).

How do I get IE to behave without needing a full URL?

Andrew Poulos
4 Answers

Andrew Poulos

8/11/2014 4:33:00 AM

0

On 11/08/2014 11:46 AM, Andrew Poulos wrote:
> If I make an XHR call to
> [server]/projects/test
> IIS returns "HTTP/1.1 405 Method Not Allowed" even though I've edited
> the handler mappings to allow "all" verbs to file or folder.
>
> All the files are on the same server.
>
> If set IIS to do a URL rewrite to temporarily add a trail slash so that
> [server]/projects/test
> becomes
> [server]/projects/test/
> then every browser I test will allow the XHR call to complete (return a
> status of 200). Except for IE.
>
> When I check the developer panel in IE 9 the network pane shows the
> request as pending until it finally returns 12031.
>
> When I check the developer panel in IE 10 the debug pane shows "access
> is denied" when it tries to XHR open
> xhr.open(cfg.method, url, async);
>
> If I put the full URL in
> xhr.open(cfg.method, "[server]/projects/test/default.asp", async);
> then IE allows the XHR call to complete (return a status of 200).
>
> How do I get IE to behave without needing a full URL?

I cleared the cache, cookies... and now IE 10 misbehaves the same as IE 9.

Andrew Poulos

Thomas 'PointedEars' Lahn

8/11/2014 5:44:00 PM

0

Andrew Poulos wrote:

> If I make an XHR call to
> [server]/projects/test
> IIS returns "HTTP/1.1 405 Method Not Allowed" even though I've edited
> the handler mappings to allow "all" verbs to file or folder.

This implies that you are not making either a GET or a POST request.

> All the files are on the same server.

Irrelevant. The *URI* scheme, host name, and server-side port number of the
resource to be accessed matter.

> If set IIS to do a URL rewrite to temporarily add a trail slash so that
> [server]/projects/test
> becomes
> [server]/projects/test/
> then every browser I test will allow the XHR call to complete (return a
> status of 200). Except for IE.

Server-side URL rewrite is AFAIK not visible to the client. If the URI
basically works, the former cannot be the reason for XHR failure. However,
that you are using a different URI then may be, because of client-side
caching.

> When I check the developer panel in IE 9 the network pane shows the
^^^^^^^^^^^^^^^^^^^^^^^
> request as pending until it finally returns 12031.
^^^^^
> When I check the developer panel in IE 10 the debug pane shows "access
^^^^^^^^^^^^^^^^^^^^^^^^
> is denied" when it tries to XHR open
> xhr.open(cfg.method, url, async);
^^^ ^^^^^^^^^^^ ^^^ ^^^^^
> If I put the full URL in
> xhr.open(cfg.method, "[server]/projects/test/default.asp", async);
^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^
> then IE allows the XHR call to complete (return a status of 200).
>
> How do I get IE to behave without needing a full URL?

I do not think, especially now that you have discovered that the behavior is
not limited to IE 10, that it matters whether you provide a URI or a URI-
reference (there is no â??full URLâ?, see RFC 3986).

You need to provide the *full* context. A public testcase would be best,
but a more detailed description and screenshots might suffice.

See the FAQ Notes and
<http://www.catb.org/~esr/faqs/smart-questions.html#bep....

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Andrew Poulos

8/11/2014 10:36:00 PM

0

On 12/08/2014 3:43 AM, Thomas 'PointedEars' Lahn wrote:
> Andrew Poulos wrote:
>
>> If I make an XHR call to
>> [server]/projects/test
>> IIS returns "HTTP/1.1 405 Method Not Allowed" even though I've edited
>> the handler mappings to allow "all" verbs to file or folder.
>
> This implies that you are not making either a GET or a POST request.
>
>> All the files are on the same server.
>
> Irrelevant. The *URI* scheme, host name, and server-side port number of the
> resource to be accessed matter.
>
>> If set IIS to do a URL rewrite to temporarily add a trail slash so that
>> [server]/projects/test
>> becomes
>> [server]/projects/test/
>> then every browser I test will allow the XHR call to complete (return a
>> status of 200). Except for IE.
>
> Server-side URL rewrite is AFAIK not visible to the client. If the URI
> basically works, the former cannot be the reason for XHR failure. However,
> that you are using a different URI then may be, because of client-side
> caching.
>
>> When I check the developer panel in IE 9 the network pane shows the
> ^^^^^^^^^^^^^^^^^^^^^^^
>> request as pending until it finally returns 12031.
> ^^^^^
>> When I check the developer panel in IE 10 the debug pane shows "access
> ^^^^^^^^^^^^^^^^^^^^^^^^
>> is denied" when it tries to XHR open
>> xhr.open(cfg.method, url, async);
> ^^^ ^^^^^^^^^^^ ^^^ ^^^^^
>> If I put the full URL in
>> xhr.open(cfg.method, "[server]/projects/test/default.asp", async);
> ^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^
>> then IE allows the XHR call to complete (return a status of 200).
>>
>> How do I get IE to behave without needing a full URL?
>
> I do not think, especially now that you have discovered that the behavior is
> not limited to IE 10, that it matters whether you provide a URI or a URI-
> reference (there is no â??full URLâ?, see RFC 3986).
>
> You need to provide the *full* context. A public testcase would be best,
> but a more detailed description and screenshots might suffice.

Here's an XML output from the developer panel with all entries except
the last two deleted:

<?xml version="1.0" encoding="utf-8"?>
<log>
<version>1.1</version>
<creator>
<name>Internet Explorer Network Inspector</name>
<version>9.0.8112.16421</version>
</creator>
<browser>
<name>Internet Explorer</name>
<version>9.0.8112.16421</version>
</browser>
<pages>
<page>
<startedDateTime>2014-08-11T22:26:55.472+10:00</startedDateTime>
<id>0</id>
<title />
<pageTimings>
<onContentLoad>-1</onContentLoad>
<onLoad>-1</onLoad>
</pageTimings>
</page>
</pages>
<entries>
<entry>
<pageref>0</pageref>
<startedDateTime>2014-08-11T22:26:55.659+10:00</startedDateTime>
<time>0</time>
<request>
<method>PUT</method>

<url>http://localhost/comet_test/tc/statements?statementId=c3ca4cff-2196-417a-a500-10145ed455d6</url>
<httpVersion>HTTP/1.1</httpVersion>
<cookies>
<cookie>
<name>ASPSESSIONIDQARQBRTD</name>
<value>PFDHIBKAHCGCHEEDMGIJLIDH</value>
</cookie>
</cookies>
<headers>
<header>
<name>Accept</name>
<value>*/*</value>
</header>
<header>
<name>X-Experience-API-Version</name>
<value>1.0.1</value>
</header>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
<header>
<name>Referer</name>

<value>http://localhost/comet_test/lessons/golf/index.htm?endpoint=http%3A%2F%2Flocalhost%2Fcomet_test%2Ftc%2F&amp;auth=OjFjMGY4NTYxNzUwOGI4YWY0NjFkNzU5MWUxMzE1ZGQ1&amp;actor=%7B%22name%22%3A%5B%22Project%20Tin%20Can%22%5D%2C%22mbox%22%3A%5B%22mailto%3Atincan%40scorm.com%22%5D%7D&amp;activity_id=http%3A%2F%2Fexample.scorm.com%2Ftincan%2Fexample%2Fsimplestatement&amp;registration=760e3480-ba55-4991-94b0-01820dbd23a2</value>
</header>
<header>
<name>Accept-Language</name>
<value>en-au</value>
</header>
<header>
<name>Accept-Encoding</name>
<value>gzip, deflate</value>
</header>
<header>
<name>User-Agent</name>
<value>Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0;
Trident/5.0)</value>
</header>
<header>
<name>Host</name>
<value>localhost</value>
</header>
<header>
<name>Content-Length</name>
<value>707</value>
</header>
<header>
<name>Connection</name>
<value>Keep-Alive</value>
</header>
<header>
<name>Cache-Control</name>
<value>no-cache</value>
</header>
<header>
<name>Cookie</name>
<value>ASPSESSIONIDQARQBRTD=PFDHIBKAHCGCHEEDMGIJLIDH</value>
</header>
</headers>
<queryString>
<param>
<name>statementId</name>
<value>c3ca4cff-2196-417a-a500-10145ed455d6</value>
</param>
</queryString>
<postData>
<mimeType>application/json</mimeType>

<text>{"id":"c3ca4cff-2196-417a-a500-10145ed455d6","timestamp":"2014-08-11T22:26:55.659Z","actor":{"objectType":"Agent","mbox":"mailto:tincan@scorm.com","name":"Project
Tin
Can"},"verb":{"id":"http://adlnet.gov/expapi/verbs/attempted","dis...:{"und":"attempted"}},"context":{"registration":"760e3480-ba55-4991-94b0-01820dbd23a2","contextActivities":{"grouping":[{"id":"http://tincanapi.com/GolfExample_TCAPI","objectType":"Acti...}]}},"object":{"id":"http://tincanapi.com/GolfExample_TCAPI","objectType":"Acti...,"definition":{"type":"http://adlnet.gov/expapi/activities/course","...:{"en-US":"Golf
Example - Tin Can Course"},"description":{"en-US":"An overview of how to
play the great game of golf."}}}}</text>
</postData>
<headersSize>850</headersSize>
<bodySize>707</bodySize>
</request>
<response>
<status>307</status>
<statusText>Moved Temporarily</statusText>
<httpVersion>HTTP/1.1</httpVersion>
<cookies />
<headers>
<header>
<name>Content-Type</name>
<value>text/html; charset=UTF-8</value>
</header>
<header>
<name>Location</name>

<value>http://localhost/comet_test/tc/statements/?statementId=c3ca4cff-2196-417a-a500-10145ed455d6</value>
</header>
<header>
<name>Server</name>
<value>Microsoft-IIS/7.0</value>
</header>
<header>
<name>X-Powered-By</name>
<value>ASP.NET</value>
</header>
<header>
<name>Access-Control-Allow-Origin</name>
<value>*</value>
</header>
<header>
<name>Date</name>
<value>Mon, 11 Aug 2014 22:26:55 GMT</value>
</header>
<header>
<name>Content-Length</name>
<value>214</value>
</header>
</headers>
<content>
<size>0</size>
<mimeType>text/html; charset=UTF-8</mimeType>
<text />
</content>
<redirectionURL />
<headersSize>317</headersSize>
<bodySize>0</bodySize>
</response>
<cache />
<timings>
<send>0</send>
<wait>0</wait>
<receive>0</receive>
</timings>
</entry>
<entry>
<pageref>0</pageref>
<startedDateTime>2014-08-11T22:26:55.659+10:00</startedDateTime>
<time>0</time>
<request>
<method>PUT</method>

<url>http://localhost/comet_test/tc/statements/?statementId=c3ca4cff-2196-417a-a500-10145ed455d6</url>
<httpVersion>HTTP/1.1</httpVersion>
<cookies>
<cookie>
<name>ASPSESSIONIDQARQBRTD</name>
<value>PFDHIBKAHCGCHEEDMGIJLIDH</value>
</cookie>
</cookies>
<headers>
<header>
<name>Accept</name>
<value>*/*</value>
</header>
<header>
<name>X-Experience-API-Version</name>
<value>1.0.1</value>
</header>
<header>
<name>Content-Type</name>
<value>application/json</value>
</header>
<header>
<name>Referer</name>

<value>http://localhost/comet_test/lessons/golf/index.htm?endpoint=http%3A%2F%2Flocalhost%2Fcomet_test%2Ftc%2F&amp;auth=OjFjMGY4NTYxNzUwOGI4YWY0NjFkNzU5MWUxMzE1ZGQ1&amp;actor=%7B%22name%22%3A%5B%22Project%20Tin%20Can%22%5D%2C%22mbox%22%3A%5B%22mailto%3Atincan%40scorm.com%22%5D%7D&amp;activity_id=http%3A%2F%2Fexample.scorm.com%2Ftincan%2Fexample%2Fsimplestatement&amp;registration=760e3480-ba55-4991-94b0-01820dbd23a2</value>
</header>
<header>
<name>Accept-Language</name>
<value>en-au</value>
</header>
<header>
<name>Accept-Encoding</name>
<value>gzip, deflate</value>
</header>
<header>
<name>User-Agent</name>
<value>Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0;
Trident/5.0)</value>
</header>
<header>
<name>Host</name>
<value>localhost</value>
</header>
<header>
<name>Content-Length</name>
<value>707</value>
</header>
<header>
<name>Connection</name>
<value>Keep-Alive</value>
</header>
<header>
<name>Cache-Control</name>
<value>no-cache</value>
</header>
<header>
<name>Cookie</name>
<value>ASPSESSIONIDQARQBRTD=PFDHIBKAHCGCHEEDMGIJLIDH</value>
</header>
</headers>
<queryString>
<param>
<name>statementId</name>
<value>c3ca4cff-2196-417a-a500-10145ed455d6</value>
</param>
</queryString>
<postData>
<mimeType>application/json</mimeType>

<text>{"id":"c3ca4cff-2196-417a-a500-10145ed455d6","timestamp":"2014-08-11T22:26:55.659Z","actor":{"objectType":"Agent","mbox":"mailto:tincan@scorm.com","name":"Project
Tin
Can"},"verb":{"id":"http://adlnet.gov/expapi/verbs/attempted","dis...:{"und":"attempted"}},"context":{"registration":"760e3480-ba55-4991-94b0-01820dbd23a2","contextActivities":{"grouping":[{"id":"http://tincanapi.com/GolfExample_TCAPI","objectType":"Acti...}]}},"object":{"id":"http://tincanapi.com/GolfExample_TCAPI","objectType":"Acti...,"definition":{"type":"http://adlnet.gov/expapi/activities/course","...:{"en-US":"Golf
Example - Tin Can Course"},"description":{"en-US":"An overview of how to
play the great game of golf."}}}}</text>
</postData>
<headersSize>850</headersSize>
<bodySize>707</bodySize>
</request>
<response>
<cookies />
<headers />
<content>
<size>0</size>
<mimeType />
</content>
<redirectionURL />
<headersSize>0</headersSize>
<bodySize>0</bodySize>
</response>
<cache />
<timings>
<send>0</send>
<wait>0</wait>
<receive>-1</receive>
</timings>
</entry>
</entries>
</log>


Andrew Poulos

Andrew Poulos

8/12/2014 2:53:00 AM

0

On 12/08/2014 8:36 AM, Andrew Poulos wrote:
> On 12/08/2014 3:43 AM, Thomas 'PointedEars' Lahn wrote:
>> Andrew Poulos wrote:
>>
>>> If I make an XHR call to
>>> [server]/projects/test
>>> IIS returns "HTTP/1.1 405 Method Not Allowed" even though I've edited
>>> the handler mappings to allow "all" verbs to file or folder.
>>
>> This implies that you are not making either a GET or a POST request.
>>
>>> All the files are on the same server.
>>
>> Irrelevant. The *URI* scheme, host name, and server-side port number
>> of the
>> resource to be accessed matter.
>>
>>> If set IIS to do a URL rewrite to temporarily add a trail slash so that
>>> [server]/projects/test
>>> becomes
>>> [server]/projects/test/
>>> then every browser I test will allow the XHR call to complete (return a
>>> status of 200). Except for IE.
>>
>> Server-side URL rewrite is AFAIK not visible to the client. If the URI
>> basically works, the former cannot be the reason for XHR failure.

Thanks, that got me thinking and I found that the IIS URL Rewrite
module's action set to redirect. When I changed the action to a rewrite
it started behaving in IE. Why every browser and OS I tested on earlier
"worked" except for IE I don't know.

Andrew Poulos