<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ASMX and JSON &#8211; Common mistakes and misconceptions</title>
	<atom:link href="http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/feed/" rel="self" type="application/rss+xml" />
	<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/</link>
	<description>ASP.NET and AJAX code, ideas, and examples.</description>
	<lastBuildDate>Thu, 02 Feb 2012 19:50:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Tim Masterson</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55538</link>
		<dc:creator>Tim Masterson</dc:creator>
		<pubDate>Tue, 20 Dec 2011 16:27:17 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55538</guid>
		<description>Thanks this is a great article!</description>
		<content:encoded><![CDATA[<p>Thanks this is a great article!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55250</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 19 Dec 2011 17:40:20 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55250</guid>
		<description>That looks correct now. I thought it was hitting the wrong one because I didn&#039;t see the CORS headers coming from mine in your previous comment.

Let me know what you figure out to be the significant difference between yours and mine. I&#039;m curious which exactly is thwarting Firefox.</description>
		<content:encoded><![CDATA[<p>That looks correct now. I thought it was hitting the wrong one because I didn&#8217;t see the CORS headers coming from mine in your previous comment.</p>
<p>Let me know what you figure out to be the significant difference between yours and mine. I&#8217;m curious which exactly is thwarting Firefox.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55244</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 19 Dec 2011 17:08:43 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55244</guid>
		<description>This is in firefox by the way.

Calling your webservice is working fine even in ff....</description>
		<content:encoded><![CDATA[<p>This is in firefox by the way.</p>
<p>Calling your webservice is working fine even in ff&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55241</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 19 Dec 2011 17:07:58 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55241</guid>
		<description>Well it&#039;s working fine in terms of getting a response etc so if the service wasn&#039;t on the old domain then I&#039;m looking at the right place, right?

Here are the responses:
&lt;pre lang=&quot;html&quot;&gt;
MY RESPONSE:
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Allow: OPTIONS, TRACE, GET, HEAD, POST
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By-Plesk: PleskWin
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
Date: Mon, 19 Dec 2011 16:55:39 GMT
Content-Length: 4432

YOUR RESPONSE:
Cache-Control	private, max-age=0
Content-Type	application/json; charset=utf-8
Server	Microsoft-IIS/7.5
X-AspNet-Version	4.0.30319
Access-Control-Allow-Orig...	*
Access-Control-Allow-Head...	Content-Type
Date	Mon, 19 Dec 2011 16:58:32 GMT
Content-Length	19
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Well it&#8217;s working fine in terms of getting a response etc so if the service wasn&#8217;t on the old domain then I&#8217;m looking at the right place, right?</p>
<p>Here are the responses:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">MY RESPONSE:
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Allow: OPTIONS, TRACE, GET, HEAD, POST
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
X-Powered-By-Plesk: PleskWin
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: Content-Type
Date: Mon, 19 Dec 2011 16:55:39 GMT
Content-Length: 4432
&nbsp;
YOUR RESPONSE:
Cache-Control	private, max-age=0
Content-Type	application/json; charset=utf-8
Server	Microsoft-IIS/7.5
X-AspNet-Version	4.0.30319
Access-Control-Allow-Orig...	*
Access-Control-Allow-Head...	Content-Type
Date	Mon, 19 Dec 2011 16:58:32 GMT
Content-Length	19</pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55239</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 19 Dec 2011 17:04:12 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55239</guid>
		<description>I pointed the DNS for that domain to a new server a few hours ago. The change might not have resolved for you yet (you can test by trying to request WebService.asmx; it wouldn&#039;t exist on the old IP). If you know how to add a hosts entry, you can force encosia.net to map to 68.71.136.100 on your machine to be sure your requests are hitting the right spot.</description>
		<content:encoded><![CDATA[<p>I pointed the DNS for that domain to a new server a few hours ago. The change might not have resolved for you yet (you can test by trying to request WebService.asmx; it wouldn&#8217;t exist on the old IP). If you know how to add a hosts entry, you can force encosia.net to map to 68.71.136.100 on your machine to be sure your requests are hitting the right spot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55238</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 19 Dec 2011 16:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55238</guid>
		<description>They look quite different!!

&lt;PRE&gt;REQUEST TO MINE:
OPTIONS /ReportInput.asmx/HelloWorld HTTP/1.1
Host: www.wsp-sandbox6.co.uk
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Origin: null
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Pragma: no-cache
Cache-Control: no-cache

REQUEST TO YOURS:
Host	encosia.net
User-Agent	Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Accept	*/*
Accept-Language	en-gb,en;q=0.5
Accept-Encoding	gzip, deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection	keep-alive
Content-Type	application/json; charset=UTF-8
Content-Length	27
Origin	null
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>They look quite different!!</p>
<pre>REQUEST TO MINE:
OPTIONS /ReportInput.asmx/HelloWorld HTTP/1.1
Host: <a href="http://www.wsp-sandbox6.co.uk" rel="nofollow">http://www.wsp-sandbox6.co.uk</a>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Origin: null
Access-Control-Request-Method: POST
Access-Control-Request-Headers: content-type
Pragma: no-cache
Cache-Control: no-cache

REQUEST TO YOURS:
Host	encosia.net
User-Agent	Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0
Accept	*/*
Accept-Language	en-gb,en;q=0.5
Accept-Encoding	gzip, deflate
Accept-Charset	ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection	keep-alive
Content-Type	application/json; charset=UTF-8
Content-Length	27
Origin	null
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55237</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 19 Dec 2011 16:47:50 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55237</guid>
		<description>I&#039;m not sure if this will help or not, but I put a sample ASMX service up on an IIS 7.5 server with no significant customization from stock settings. It responds to the OPTIONS pre-flight request, serves the two CORS headers we&#039;ve discussed, and jQuery is able to complete a cross-domain AJAX request to it. Comparing how it responds to how yours does, what headers are present, etc may help you track down what your trouble is.

You can find that here (note the .net instead of .com): http://Encosia.net/WebService.asmx/HelloWorld.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure if this will help or not, but I put a sample ASMX service up on an IIS 7.5 server with no significant customization from stock settings. It responds to the OPTIONS pre-flight request, serves the two CORS headers we&#8217;ve discussed, and jQuery is able to complete a cross-domain AJAX request to it. Comparing how it responds to how yours does, what headers are present, etc may help you track down what your trouble is.</p>
<p>You can find that here (note the .net instead of .com): <a href="http://Encosia.net/WebService.asmx/HelloWorld" rel="nofollow">http://Encosia.net/WebService.asmx/HelloWorld</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55223</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 19 Dec 2011 15:39:52 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55223</guid>
		<description>I don&#039;t know exactly what the difference is between our configurations, but my suggestion would be to try to figure out why my server responds to the OPTIONS pre-flight with this header that yours is missing:

&lt;code&gt;Allow: OPTIONS, TRACE, GET, HEAD, POST&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know exactly what the difference is between our configurations, but my suggestion would be to try to figure out why my server responds to the OPTIONS pre-flight with this header that yours is missing:</p>
<p><code>Allow: OPTIONS, TRACE, GET, HEAD, POST</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55220</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 19 Dec 2011 15:33:57 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55220</guid>
		<description>OK thanks for all your help on this once again!!

If you know of any settings in iis or whatever that I can set to overcome this let me know.

Thanks again!!</description>
		<content:encoded><![CDATA[<p>OK thanks for all your help on this once again!!</p>
<p>If you know of any settings in iis or whatever that I can set to overcome this let me know.</p>
<p>Thanks again!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55216</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 19 Dec 2011 15:23:14 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55216</guid>
		<description>This won&#039;t work in IE9. Until IE10, IE only offers partial CORS support, which does not include the ability to pre-flight a request and obtain permission to send the Content-Type header.</description>
		<content:encoded><![CDATA[<p>This won&#8217;t work in IE9. Until IE10, IE only offers partial CORS support, which does not include the ability to pre-flight a request and obtain permission to send the Content-Type header.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55214</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 19 Dec 2011 15:19:04 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55214</guid>
		<description>sorry meant to say also get the error in ie9.</description>
		<content:encoded><![CDATA[<p>sorry meant to say also get the error in ie9.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55213</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 19 Dec 2011 15:18:40 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55213</guid>
		<description>Yes it was in firefox, also just got the yey1 alert (so an error) but yes in chrome it did give me the yey alert(so it worked!)

Is the problem something that can be changed on the server then? I have access to it!</description>
		<content:encoded><![CDATA[<p>Yes it was in firefox, also just got the yey1 alert (so an error) but yes in chrome it did give me the yey alert(so it worked!)</p>
<p>Is the problem something that can be changed on the server then? I have access to it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave Ward</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55212</link>
		<dc:creator>Dave Ward</dc:creator>
		<pubDate>Mon, 19 Dec 2011 15:14:30 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55212</guid>
		<description>By the error message, I&#039;m assuming this is happening in Firefox? When I successfully requested your site with CORS, I was using Chrome.

One thing that might be causing your trouble is that your server isn&#039;t responding to the OPTIONS &quot;pre-flight&quot; with an &lt;code&gt;Allow&lt;/code&gt; header at all. My sites that are using CORS for ASMX do reply to OPTIONS with an Allow header of &quot;OPTIONS, TRACE, GET, HEAD, POST&quot;.

Firefox may be considering the OPTIONS request a failure because the response indicates that OPTIONS isn&#039;t allowed.</description>
		<content:encoded><![CDATA[<p>By the error message, I&#8217;m assuming this is happening in Firefox? When I successfully requested your site with CORS, I was using Chrome.</p>
<p>One thing that might be causing your trouble is that your server isn&#8217;t responding to the OPTIONS &#8220;pre-flight&#8221; with an <code>Allow</code> header at all. My sites that are using CORS for ASMX do reply to OPTIONS with an Allow header of &#8220;OPTIONS, TRACE, GET, HEAD, POST&#8221;.</p>
<p>Firefox may be considering the OPTIONS request a failure because the response indicates that OPTIONS isn&#8217;t allowed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55143</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 19 Dec 2011 09:10:57 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55143</guid>
		<description>I&#039;m just getting:&quot;NetworkError: 500 Internal Server Error - http://www.wsp-sandbox6.co.uk/ReportInput.asmx/HelloWorld&quot;</description>
		<content:encoded><![CDATA[<p>I&#8217;m just getting:&#8221;NetworkError: 500 Internal Server Error &#8211; <a href="http://www.wsp-sandbox6.co.uk/ReportInput.asmx/HelloWorld" rel="nofollow">http://www.wsp-sandbox6.co.uk/ReportInput.asmx/HelloWorld</a>&#8220;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://encosia.com/asmx-and-json-common-mistakes-and-misconceptions/#comment-55142</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Mon, 19 Dec 2011 09:09:55 +0000</pubDate>
		<guid isPermaLink="false">http://encosia.com/?p=971#comment-55142</guid>
		<description>I don&#039;t understand.... not working for me but as you can see I have a very basic page?

&lt;pre lang=&quot;html&quot;&gt;&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Test&lt;/title&gt;			
    &lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
       function testFunction() {
	   	   
	       //url: &quot;http://localhost:1664/CCBCWSTest/ReportInput.asmx/HelloWorld&quot;,	      
	       $.ajax({
	           url: &#039;http://www.wsp-sandbox6.co.uk/ReportInput.asmx/HelloWorld&#039;,
	           type: &#039;POST&#039;,
	           contentType: &#039;application/json&#039;,
	           data: &#039;{&quot;streetName&quot;:&quot;Any Street&quot;}&#039;,
	           success: function (result) { console.log(result) }
	       });	   
        }
    &lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;			
	&lt;button onclick=&quot;javascript:testFunction(); &quot;&gt;Let my phone find my location&lt;/button&gt;				
&lt;/body&gt;
&lt;/html&gt;&lt;/pre&gt;

Any ideas? Thanks for your help again!</description>
		<content:encoded><![CDATA[<p>I don&#8217;t understand&#8230;. not working for me but as you can see I have a very basic page?</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;html&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title&gt;</span></span>Test<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title&gt;</span></span>			
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span>script&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
       function testFunction() {
&nbsp;
	       //url: &quot;http://localhost:1664/CCBCWSTest/ReportInput.asmx/HelloWorld&quot;,	      
	       $.ajax({
	           url: 'http://www.wsp-sandbox6.co.uk/ReportInput.asmx/HelloWorld',
	           type: 'POST',
	           contentType: 'application/json',
	           data: '{&quot;streetName&quot;:&quot;Any Street&quot;}',
	           success: function (result) { console.log(result) }
	       });	   
        }
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></span>			
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;button</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:testFunction(); &quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Let my phone find my location<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/button&gt;</span></span>				
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></pre></div></div>

<p>Any ideas? Thanks for your help again!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

