IIS7 URL Rewrite QuickTip: Allow Flash Gateway

We all know that ColdFusion allows Flash Remoting (AMF) communication to occur via two separate URL strings:

  • http://my.site.com/flex2gateway
  • http://my.site.com/flashservices/gateway

I recently came across the problem where the URL Rewrite rules in IIS7 were blocking both of these URLs from being passed on and correctly processed by ColdFusion. The solution is to add the following two rules to your site definition and move them both to the top of the stack, above any other rules you may have. This will effectively allow both of these URLs to process normally and stop and subsequent rules from executing if the pattern matches.

You can also edit your site definition web.config file to add the rules there:

1
2
3
4
5
6
7
8
9
10
<rule name="flashservices/gateway" stopProcessing="true">
	<match url="flashservices/gateway" />
	<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
	<action type="None" />
</rule>
<rule name="flex2gateway" patternSyntax="ExactMatch" stopProcessing="true">
	<match url="flex2gateway" />
	<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
	<action type="None" />
</rule>

Again, be sure they appear before any other rules and you should be good to go! Flash on!

Remoting through Flex with Coldfusion

I’m used to setting the ObjectEncoding to AMF0 when working with Flash Media Server 2, but haven’t realized till now that I also am required to do this when communicating with Coldfusion 8 through remoting:

1
2
3
import flash.net.NetConnection;
import flash.net.ObjectEncoding;
NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;

The error “Unknown object type tag (17)” was being generated by CF8 as I attempted to pass an Object in AS3 over remoting to CF8 interpreted as a Structure. Apparently, there is also the need to wrap any such Object within a container Object for it to be properly read by the CFC:

1
2
3
4
var wrapper:Object = new Object();
wrapper.submissionObject = submissionObject;
submissionResponder = new Responder(onSubmissionResult, onSubmissionError);
testConnection.call("some.cfc.Test", submissionResponder, wrapper);

The CFC function expects a Structure named “submissionObject” in this case.

I hope this is helpful for someone- I had a hell of a time digging up this information.