Hi!
I have a web portal, that is based on MVC and has embedded Silverlight app on one of it's page.
SL application generate file, that should be sent to server by calling MVC action.
What I have tried....
Code in SL app:
HtmlPage.Window.Invoke("SendNewImage", new object[] { bitmap.PixelWidth, bitmap.PixelHeight, stream.ToArray()});
SendNewImage function in JS:
function SendNewImage(width, height, pixels) {
$.post("/Files/UploadImage", { 'pixels[]': pixels },
function (success) {
},"json"
);
MVC action:
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult UploadImage(byte[] pixels)
{
return Json(new object[] {});
}
Problems...
When I send byte[] to JS as a parameter of Invoke(), I dont get Array inside javascript function. Instead I have 'object' pixels, that is not looking as Array in firebug, but I can get values by calling pixels[10], for example.
Then, when I recieve data in MVC action, then is NULL. I dont where is the problem...while senind to JS, or while calling MVC action. Anybody knows?
Thanks