To call an ASP.NET aspx page from Flash Remoting MX, the aspx page must reside
within the directory or subdirectories of a Flash Remoting-enabled .NET
application.
Sample application directory (the ASP.NET application in this sample is called "FluorineWeb"):
INetPub
wwwroot
FluorineWeb
(virtual directory of the sample application 'FluorineWeb')
FluorineWeb.csproj
\bin
MyWebForm.aspx
Global.asax
Gateway.aspx
\TestModule
MyModuleWebForm.aspx
Specify the Flash Remoting gateway URL and the name of the service that you
want to access.
The gateway URL must reference an ASPX page inside the application directory
(this is usualy "Gateway.aspx" see setup).
To get a reference to an ASPX page based service you must provide the fully
qualified path to the directory that contains the page to invoke.
In the above sample the correct service names are "FluorineWeb" and
"FluorineWeb/TestModule"
The service will represent a reference to the directory that contains the ASPX
page.
var service:Service = new Service("http://127.0.0.1/FluorineWeb/gateway.aspx",
null, "FluorineWeb");
or
var service:Service = new Service("http://127.0.0.1/FluorineWeb/gateway.aspx",
null, "FluorineWeb/TestModule");
The ASPX page's file name becomes the function name of the Service (the
reference to the page's directory structure).
var pendingCall:PendingCall = service.MyWebForm();
respectively
var pendingCall:PendingCall = service.MyModuleWebForm(1,"test");
To access data passed from Flash applications you use the HttpContext Items
property.
( The HttpContext object contains information associated with the current page.
The HttpContext's Items property is a key-value collection which is shared
between Http modules during an HTTP request. Fluorine stores the data passed
from Flash in the HttpContext object and returns the results stored the HttpContext object )
Data passed from Flash applications is stored with "flash.parameters" key and it is an IList.
Results must be stored with "flash.result" key.
Sample code:
public class MyModuleWebForm : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
IList parameters = this.Context.Items["flash.parameters"] as IList;
if( parameters == null )
throw new Exception("No arguments received.");
this.Context.Items["flash.result"] = "Result form MyModuleWebForm.aspx";
}
...
To return custom ASP.NET exceptions to Flash, simply use the throw statement (see example above).
Fluorine doesn't implement a custom server control for ASPX pages for Flash Remoting.