NetConnection.setCredentials( ) Method | Flash 6 |
authenticates a user with a credentials header |
A username to be used by the server for authentication.
A password to be used by the server for authentication.
The setCredentials( ) method is used when you have an authentication routine on your server that works in tandem with a credentials header. After calling setCredentials( ), the credentials header is attached to every AMF packet generated by the client and going to the server.
As of this writing, only JRun 4 and ColdFusion MX support the credentials header. Calling setCredentials( ) is the same thing as calling the addHeader( ) method, like this:
my_conn.addHeader("Credentials", false, {userid: userid, password: password});
The following code shows the basic syntax of the setCredentials( ) method:
if (connected == null) { connected = true; NetServices.setDefaultGatewayUrl("http://127.0.0.1/flashservices/gateway"); var my_conn = NetServices.createGatewayConnection( ); my_conn.setCredentials(username_txt.text, password_text.text); }
In this case, the credentials header is added to the AMF packet and every subsequent AMF packet going to the server.
NetConnection.addHeader( ); Chapter 4, Chapter 5, Chapter 7