繁体   English   中英

使用amf远程控制与asp.net mvc

[英]use amf remoting with asp.net mvc

有人知道是否可以使用amf远程控制从flash到asp.net mvc动作进行调用?

如果有,怎么样? 应该使用哪些技术以及如何将它们结合起来

在闪存方面它将是这样的:

    //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'和“Test”anyware

谢谢

我没有完整的答案,但这可以帮助你一开始。

你可以使用FluorineFx,这是一个很好的开始,因为它实现了所有AMF的东西,它有AMFWriter / Reader,AMFDeserializer等,玩它们。

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 for asp.net mvc

祝好运。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM