当尝试向asp.net asmx web服务发送post请求时,我看到(在charles和firebug中)它以get的形式通过。
这是我的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);
}

这似乎是flash的一个问题,因为它在进入服务器之前就已经发生了。我已经把这个上传到了一个测试服务器上,我仍然看到它作为一个get来完成。任何帮助都将不胜感激。谢谢。

最佳答案

来自actionscript lr(urlrequest类,方法属性):
注意:如果在flash player中运行并且引用的表单没有正文,flash player会自动使用get操作,即使方法设置为urlrequestmethod.post。因此,建议始终包含“虚拟”主体,以确保使用正确的方法。
你在用那个“假”身体吗?

关于actionscript-3 - AS3 POST请求作为GET发送,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3557264/

10-11 01:30