Skip to main content
Participating Frequently
February 22, 2010
Question

Ajax Post to .cfm throws IIS 500 (but same post to .aspx does not error)

  • February 22, 2010
  • 3 replies
  • 1997 views

I have a cross domain ajax call properly set up and tested to resolve to a .cfm but IIS throws a 500 error.

Here is the scenario:

On one domain (a.tld) I have an ajax application.

This application posts to another domain (b.tld).

When a.tld posts to a .cfm on b.tld, I get a 500 error. But, when a.tld posts to a .aspx on b.tld, it returns just fine. Both the .cfm and the .aspx are returning a single json name value pair (really just some text).

Now, this is interesting, when I switch the POST to a GET, the .cfm works just fine. So, to summarize:

1. ajax POST to aspx works fine.

2. ajax POST to cf gives 500 error.

3. ajax GET to cf is fine.

So, this appears that IIS is blocking ColdFusion from getting the cross domain ajax call or that ColdFusion does not have permission to act on the POST. Does anyone know what might be causing this issue?

This topic has been closed for replies.

3 replies

February 24, 2010

I guess there would not be an error message per say.   In the onreadystatechange function can you alert the xmlhttp.status if the status is not 200?  I’m guessing it will be 500.

February 24, 2010

It was about a year ago when we tried to implement ajax POST that we saw the same 500 error.  Ajax GET worked fine, ajax POST had intermittent successes.  Sometimes it worked, sometimes it did not.  It was bad enough that we had to create a workaround which is still in production today. 

I remember googling the error and eventually found a document that confirmed it problem as a bug.  It’s been so long that I can’t remember exactly if it said the problem was CF or the browser or apache.  (We are CF / Apache / ie and ff).

Wish I could find that doc again…I’ll spend some more time looking…. can you supply the whole error message?

Participating Frequently
February 24, 2010

I have not found a way to get to the error. The only thing that comes back is the ugly IIS 500 page. There is no verboseness or anything of the sort.

February 23, 2010

Have the same problem.  Ajax and Post do not play well together.  Last I checked it is a browser problem.

Using “GET” is a problem too if you need to ajax a lot of data. . 

If you are using the ajax to validate a page, a good work around is to open a dhtml iframe window (see http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm) and then do the validation in popup window. 

As you are validating, use cfflush to show what’s going on:

Checking value 1:  Pass

Checking value 2:  Pass

Checking value 3: Fail  - date range is not valid.

.

Participating Frequently
February 24, 2010

In the past, POST and Ajax have not been an issue for me. Even on my own environment (OSX/Apache/CF) this particular scenario works perfectly. I did not encounter this problem until switching my code to the IIS/CF environment. The real problem seems to be CF on IIS when using POST in a cross domain script. Normal Ajax POSTs work fine in the IIS/CF environment when they are not cross domain.

Inspiring
February 24, 2010

Have you posted that same data to your page via an HTML/CF form to verify that your error isn't caused by your page logic?