flash.net.NetConnection is a native Flash Player class that is the workhorse for AMF based communication. Flash and Flex applications make use of NetConnection to send AMF formatted requests over HTTP or HTTPS to servers such as Flash Remoting, ColdFusion, BlazeDS, etc. However, less HTTP features are exposed by NetConnection than those of flash.net.URLLoader.
This can be a pain when your network architecture has one or more firewalls between external Flash Player clients and your application server. If authentication or session management is performed at the firewall, session timeouts can introduce an annoying problem. If a client makes an AMF request after a session has timed out, the session management layer may challenge the client to re-authenticate. This challenge is unlikely to be an AMF formatted response and so NetConnection is unable to process the information. While the client knows the request failed, the exact cause of failure is not known.
So… I hacked together a prototype replacement for NetConnection based on flash.net.URLLoader. This new “AMFConnection” class creates binary flash.net.URLRequests and sends HTTP POST data as an AMF formatted request and processes the AMF formatted response returned to URLLoader. One could subclass AMFConnection and intercept the response data and try to detect that an HTML re-authentication page has been returned to the client.