Flex 应用程序上的 IE 跨域过滤器

发布于 2024-08-18 22:41:15 字数 4918 浏览 6 评论 0原文

我有一个使用 Flex 表单来捕获用户输入的应用程序。当用户输入表单数据(包括绘图区域)时,应用程序会创建表单的 jpg 图像并发回服务器。由于数据比较敏感,所以必须使用https。此外,客户端需要将 jpg 和 pdf 版本的表单存储在服务器上。

应用程序分三步发送回数据

1 - 发送带有订单号的 jpg 快照

2 - 将表单数据字段作为发布数据发送,因此它在地址栏中不可见

3 - 发送 pdf 数据

我首先使用 urlloader 发送 jpg 数据等待服务器响应后再执行操作2和3,以确保服务器已经创建了与新的orderNumber关联的记录。

此代码通过 http 在 IE 中运行良好。但是,如果我尝试通过 https 使用应用程序,IE 会阻止 store jpg 步骤的页面响应,并且 urlloader 的完整事件永远不会触发。该应用程序通过 http 或 https 在 FireFox 中运行良好。

这是 crossdomain.xml (我已将域替换为“”):

<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>

  <allow-access-from domain="*.<mydomain>.com" to-ports="*" secure="false"/>
  <allow-http-request-headers-from domain="*.<mydomain>.com" headers="*">

</cross-domain-policy> 

这是用户按下提交按钮时执行的代码:

private function loaderCompleteHandler(event:Event):void {

            sendPDF();
            sendPatientData();
        }


        private function submitOrder(pEvt:MouseEvent):void
        {
            //disable submit form so the order can't be submitted twice
            formIsValid = false;
            waitVisible = true;

            //submit the jpg image first with the order number, userID, provID
            //and order type.  The receiveing asp will create the new order record
            //and save the jpg file.  jpg MUST be sent first.
            orderNum = userID + "." + provID + "." + Date().toString() + "." + orderType;

            var jpgURL:String = "https://orders.mydomain.com/orderSubmit.asp?sub=jpg&userID=" + userID + "&provID=" + provID + "&oNum=" + orderNum + "&oType=" + orderType;

            var jpgSource:BitmapData = new BitmapData (vbxPrint.width, vbxPrint.height);
            jpgSource.draw(vbxPrint);
            var jpgEncoder:JPEGEncoder = new JPEGEncoder(100);
            var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

            var header:URLRequestHeader = new URLRequestHeader ("content-type", "application/octet-stream");

            //Make sure to use the correct path to jpg_encoder_download.php
            var jpgURLRequest:URLRequest = new URLRequest (jpgURL);     
            jpgURLRequest.requestHeaders.push(header);              
            jpgURLRequest.method = URLRequestMethod.POST;               
            jpgURLRequest.data = jpgStream;

            //navigateToURL(jpgURLRequest, "_blank");

            var  jpgURLLoader:URLLoader = new URLLoader();

            try
            {
                jpgURLLoader.load(jpgURLRequest);
            }
            catch (error:ArgumentError)
            {
                trace("An ArgumentError has occurred.");
            }
            catch (error:SecurityError)
            {
                trace("A SecurityError has occurred.");
            }

            jpgURLLoader.addEventListener(Event.COMPLETE, loaderCompleteHandler);

        }


        private function sendPatientData ():void
        {
            var dataURL:String = "https://orders.mydomain.com/orderSubmit.asp?sub=data&oNum=" + orderNum + "&oType=" + orderType;

            //Make sure to use the correct path to jpg_encoder_download.php
            var dataURLRequest:URLRequest = new URLRequest (dataURL);       
            dataURLRequest.method = URLRequestMethod.POST;
            var dataUrlVariables:URLVariables = new URLVariables(); 

            dataUrlVariables.userID = userID
            dataUrlVariables.provID = provID
            dataUrlVariables.name = txtPatientName.text
            dataUrlVariables.dob = txtDOB.text
            dataUrlVariables.contact = txtPatientContact.text
            dataUrlVariables.sex=txtSex.text
            dataUrlVariables.ind=txtIndications.text

            dataURLRequest.data = dataUrlVariables
            navigateToURL(dataURLRequest, "_self");     

        }

        private function sendPDF():void
        {
            var url:String = "https://orders.mydomain.com/pdfOrderForm.asp"
            var fileName:String = "orderPDF.pdf&sub=pdf&oNum=" + orderNum + "&oType=" + orderType + "&f=2&t=1" + "&mid=" + ModuleID.toString()
            var jpgSource:BitmapData = new BitmapData (vbxPrint.width, vbxPrint.height);
            jpgSource.draw(vbxPrint);
            var jpgEncoder:JPEGEncoder = new JPEGEncoder(100);
            var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

            myPDF = new PDF( Orientation.LANDSCAPE,Unit.INCHES,Size.LETTER);
            myPDF.addPage(); 
            myPDF.addImageStream(jpgStream,0,0, 0, 0, 1,ResizeMode.FIT_TO_PAGE );
            myPDF.save(Method.REMOTE,url,Download.ATTACHMENT,fileName);

        }

目标 asp 页面未发送返回除基本站点页面模板之外的任何数据。

谁能帮我解决 IE 跨域问题?我已经在IE工具安全设置中关闭了XSS过滤器,但这仍然没有解决问题。

谢谢

I have an application that uses a flex form to capture user input. When the user has entered the form data (which includes a drawing area) the application creates a jpg image of the form and sends back to the server. Since the data is sensitive, it has to use https. Also, the client requires both jpg and pdf versions of the form to be stored on the server.

The application sends data back in three steps

1 - send the jpg snapshot with ordernumber

2 - send the form data fields as post data so it is not visible in the address bar

3 - send the pdf data

I am sending the jpg data first using urlloader and waiting for the server to respond before performing opperation 2 and 3 to ensure that the server has created the record associated with the new orderNumber.

This code works fine in IE over http. But If I try to use the application over https, IE blocks the page response from store jpg step and the complete event of the urlloader never fires. The application works fine in FireFox over http or https.

Here is the crossdomain.xml (I have replaced the domain with ""):

<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy>

  <allow-access-from domain="*.<mydomain>.com" to-ports="*" secure="false"/>
  <allow-http-request-headers-from domain="*.<mydomain>.com" headers="*">

</cross-domain-policy> 

Here is the code that is executed when the user presses the submit button:

private function loaderCompleteHandler(event:Event):void {

            sendPDF();
            sendPatientData();
        }


        private function submitOrder(pEvt:MouseEvent):void
        {
            //disable submit form so the order can't be submitted twice
            formIsValid = false;
            waitVisible = true;

            //submit the jpg image first with the order number, userID, provID
            //and order type.  The receiveing asp will create the new order record
            //and save the jpg file.  jpg MUST be sent first.
            orderNum = userID + "." + provID + "." + Date().toString() + "." + orderType;

            var jpgURL:String = "https://orders.mydomain.com/orderSubmit.asp?sub=jpg&userID=" + userID + "&provID=" + provID + "&oNum=" + orderNum + "&oType=" + orderType;

            var jpgSource:BitmapData = new BitmapData (vbxPrint.width, vbxPrint.height);
            jpgSource.draw(vbxPrint);
            var jpgEncoder:JPEGEncoder = new JPEGEncoder(100);
            var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

            var header:URLRequestHeader = new URLRequestHeader ("content-type", "application/octet-stream");

            //Make sure to use the correct path to jpg_encoder_download.php
            var jpgURLRequest:URLRequest = new URLRequest (jpgURL);     
            jpgURLRequest.requestHeaders.push(header);              
            jpgURLRequest.method = URLRequestMethod.POST;               
            jpgURLRequest.data = jpgStream;

            //navigateToURL(jpgURLRequest, "_blank");

            var  jpgURLLoader:URLLoader = new URLLoader();

            try
            {
                jpgURLLoader.load(jpgURLRequest);
            }
            catch (error:ArgumentError)
            {
                trace("An ArgumentError has occurred.");
            }
            catch (error:SecurityError)
            {
                trace("A SecurityError has occurred.");
            }

            jpgURLLoader.addEventListener(Event.COMPLETE, loaderCompleteHandler);

        }


        private function sendPatientData ():void
        {
            var dataURL:String = "https://orders.mydomain.com/orderSubmit.asp?sub=data&oNum=" + orderNum + "&oType=" + orderType;

            //Make sure to use the correct path to jpg_encoder_download.php
            var dataURLRequest:URLRequest = new URLRequest (dataURL);       
            dataURLRequest.method = URLRequestMethod.POST;
            var dataUrlVariables:URLVariables = new URLVariables(); 

            dataUrlVariables.userID = userID
            dataUrlVariables.provID = provID
            dataUrlVariables.name = txtPatientName.text
            dataUrlVariables.dob = txtDOB.text
            dataUrlVariables.contact = txtPatientContact.text
            dataUrlVariables.sex=txtSex.text
            dataUrlVariables.ind=txtIndications.text

            dataURLRequest.data = dataUrlVariables
            navigateToURL(dataURLRequest, "_self");     

        }

        private function sendPDF():void
        {
            var url:String = "https://orders.mydomain.com/pdfOrderForm.asp"
            var fileName:String = "orderPDF.pdf&sub=pdf&oNum=" + orderNum + "&oType=" + orderType + "&f=2&t=1" + "&mid=" + ModuleID.toString()
            var jpgSource:BitmapData = new BitmapData (vbxPrint.width, vbxPrint.height);
            jpgSource.draw(vbxPrint);
            var jpgEncoder:JPEGEncoder = new JPEGEncoder(100);
            var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

            myPDF = new PDF( Orientation.LANDSCAPE,Unit.INCHES,Size.LETTER);
            myPDF.addPage(); 
            myPDF.addImageStream(jpgStream,0,0, 0, 0, 1,ResizeMode.FIT_TO_PAGE );
            myPDF.save(Method.REMOTE,url,Download.ATTACHMENT,fileName);

        }

The target asp page is not sending back any data, except the basic site page template.

Can anyone help me figure out how to get around this IE crossdomain issue? I have turned off the XSS filter in IE tools security settings, but that still didn't solve the problem.

THANKS

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水晶透心 2024-08-25 22:41:15

一切都通过 https 进行。从 https url 加载 swf。通过 https 发送初始表单帖子。通过 https 发送图像。

Do everything over https. Load the swf from an https url. Send the initial form post via https. Send the images via https.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文