Asp.net MVC

im wonders if it is possible to return a serialized AMF object in a control action in ASP.net MVC by anyone, as I tried before?

early.

+3
source share
3 answers

I have little experience with MVC, but I did some testing using AMF data for the Flash client. I did to create a generic handler that used the ByteArray class in FluorineFX. I instantiated the object and wrote it to ByteArray using WriteObject (). Then I wrote the ByteArray data to the response stream. In Flash, I then used the standard URLLoader and used ReadObject () from (URLLoader.data as ByteArray), and I had my deserialized object and ready to go. (Of course, I had to run the RemoteClass and registerClassAlias ​​commands first)

My assumption is that the MVC action allows you to access the response flow, so you should be installed.

+1
source

, AMF (, google, ). , U ASP.MVC. , JSON .

SO:

public ActionResult MyAction()
{    
    ... 
    // Populate myObject    
    return new JsonResult{ Data = myObject };
}

, , , AMF . , , .

.

public ActionResult MyAction()
{    
    ... 
    // Populate myObject    
    return new JsonResult
        { 
            Data = new
            {
                Id = object.Id,
                Name = object.FirstName + ' ' object.Surname,
                .... etc ....
            }
        };
}

.

+1

Source: https://habr.com/ru/post/1705797/


All Articles