0

Our app has a main module with link button, and clicking each link button loads different modules in the main content area.

For only one module, we get a Security Sandbox Violation when we try to do a multipart post of image data.

I can't find anything significantly different about this module, other modules do multipart posts fine.

I have added thre SWF and various folders (such as containing folder, its parent, etc.) to flash player global settings, but no luck. We added a liberal cross domain file but still no luck.

BTW, we are using ModuleLoader, should we try ModuleManager?

Please help.

Security Sandbox Violation

Connection to http://localhost:PORTNUMBERHIDDEN/services/rest/mycompany/222/assetservice/asset?action=saveasset&objecttype=serviceOffer&objectid=5960&User-Agent=flex3.0&randomNum=1328144876976

halted - not permitted from

file:///C:/Perforce/Main/Portal/main/bin-debug/serviceOffer-2.4.0.18-SNAPSHOT.swf

Mp0int
  • 18,172
  • 15
  • 83
  • 114
Greg Lafrance
  • 768
  • 1
  • 7
  • 18

1 Answers1

0

I got the answer from this web post:

Unexpected Flash Security Exception When Using URLLoader

Instead of setting the contentType like this:

request.contentType = "multipart/form-data;boundary=" + POSTUploadBuilder.boundary;

Set the contentType like this:

request.requestHeaders.push(new URLRequestHeader('Content-Type', 'multipart/form-data;
boundary=' + POSTUploadBuilder.boundary));

This is how I create the boundry in my POSTUploadBuilder class:

public class POSTUploadBuilder {
    private static var _boundary:String = "";
    private static var _mainBoundary:String = "";

    public static function get boundary():String {
        if(_boundary.length == 0) {
            var i:uint = 0;
            var len:uint = 0x20;

            for(; i < len; ++i) {
                _boundary += String.fromCharCode(uint(97 + Math.random() * 25));
            }
        }

        return _boundary;
    }
Community
  • 1
  • 1
Greg Lafrance
  • 768
  • 1
  • 7
  • 18