开发者

AS3 POST Request sending as a GET

When trying to send a POST request to an ASP.NET asmx web service I am seeing (in Charles and Firebug)开发者_JAVA技巧 it go through as a GET.

Here is my AS3

public function save(page:SharedPageVO, callback :Function = null): void {
   var req:URLRequest = new URLRequest( "service.asmx/CreateSharedPage" );
   req.data = page;
   req.method = URLRequestMethod.POST;
   if (callback != null)
   {
    //handle removing the event here instead of there
    this.complete = callback;
    DataService.instance.addEventListener(Event.COMPLETE, onComplete);
   }
   DataService.instance.load( req );
}

public var complete:Function;
private function onComplete(e:Event)
{
 if (complete != null) complete(e);
 complete = null;
 DataService.instance.removeEventListener(onComplete);
}

This seems to be an issue with flash as it is happening before it even goes to the server. I have uploaded this to a testing server and I still see it come through as a GET. Any help would be appreciated. Thanks.


From actionscript LR (URLRequest class, method property):

Note: If running in Flash Player and the referenced form has no body, Flash Player automatically uses a GET operation, even if the method is set to URLRequestMethod.POST. For this reason, it is recommended to always include a "dummy" body to ensure that the correct method is used.

Are you using that "dummy" body?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜