使用AMF远程与asp.net的MVC [英] use amf remoting with asp.net mvc

查看:140
本文介绍了使用AMF远程与asp.net的MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是否有可能从闪存做电话使用AMF远程到ASP.NET MVC的行动?

anybody knows if it is possible to do calls from flash to asp.net mvc actions using amf remoting ?

如果是,如何?该技术应该使用,以及如何将它们结合起来。

if yes, how? which technologies should be used and how to combine them

在闪存方面,它会是这样的:

on the flash side it would be something like this:

    //Connect the NetConnection object
    var netConnection: NetConnection = new NetConnection();
    netConnection.connect("http://localhost:59147/Home/Index");

   //Invoke a call
   log("invoke call TestMethod");
   var responder : Responder = new Responder( handleRemoteCallResult, handleRemoteCallFault);
   netConnection.call('TestMethod', responder, "Test");

我想这和它击中了行动,但我无法找到TestMethod的和测试anyware的请求

I tried this and it hits the action but I can't find the 'TestMethod' and "Test" anyware in the Request

感谢您

推荐答案

我没有一个完整的答案,但是这可能会帮助您开始。

I don't have a complete answer, but this could help you in the start.

您可以使用FluorineFx,这是一个良好的开端,因为它实现了所有的AMF的东西,它有AMFWriter /读卡器,AMFDeserializer等,他们一起玩。

You could use FluorineFx, that is a good start as it implements all the AMF stuff and it has AMFWriter/Reader, AMFDeserializer and so, play with them.

using System.Web.Mvc;
using FluorineFx.IO;

public class AMFFilterAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        if (filterContext.HttpContext.Request.ContentType == "application/x-amf")
        {
            var stream = filterContext.HttpContext.Request.InputStream;

            var deserializer = new AMFDeserializer(stream);
            var message = deserializer.ReadAMFMessage();

            foreach (var body in message.Bodies) // not foreach, just the first one
            {
                filterContext.ActionParameters["method"] = body.Target;
                filterContext.ActionParameters["args"] = body.Content;
            }

            base.OnActionExecuting(filterContext);
        }
    }
}

[AMFFilter]
[HttpPost]
public ActionResult Index(string method, object[] args)
{
    return View();
}

这仅仅是第一部分。返回二进制数据之类的东西可以通过某种自定义的ActionResult的处理,而是一个你知道该怎么做,从这里的 AMF的ActionResult的asp.net mvc的

This is just the first part. Returning binary data and stuff could be handled by some kind of custom ActionResult, but that one you know how to do from here AMF ActionResult for asp.net mvc ?

祝你好运。

这篇关于使用AMF远程与asp.net的MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆