コード例 #1
0
        public async Task <ActionResult> XADESXL()
        {
            try
            {
                using (Stream xmlData = Assembly.GetExecutingAssembly().GetManifestResourceStream("Demo.xml"))
                {
                    // No se solicita la imagen del QR si se consulta desde un móvil, por que en vez del QR mostramos un botón
                    bool generateQRImage = !IsMobile(Request);
#if MONO
                    DocumentStoreResponse document = signatureServices.UploadXMLXLAsync(fileData: xmlData,
                                                                                        contentLength: xmlData.Length,
                                                                                        endUserMessage: END_USER_MESSAGE,
                                                                                        generateQRHTMLImage: generateQRImage,
                                                                                        awaitForManualDestroy: MANUAL_DESTROY,
                                                                                        signatureExpirationSecondstionSeconds: EXPIRATION_SECONDS,
                                                                                        manageIFrameSignatureStatus: true).Result;
#else
                    DocumentStoreResponse document = await signatureServices.UploadXMLTAsync(fileData : xmlData,
                                                                                             contentLength : xmlData.Length,
                                                                                             endUserMessage : END_USER_MESSAGE,
                                                                                             generateQRHTMLImage : generateQRImage,
                                                                                             awaitForManualDestroy : MANUAL_DESTROY,
                                                                                             signatureExpirationSecondstionSeconds : EXPIRATION_SECONDS,
                                                                                             manageIFrameSignatureStatus : true);
#endif
                    ViewBag.isPDF = false;
                    return(View("Sign", document));
                }
            }
            catch (Exception ex)
            {
                ViewData["error"] = Global.HandleError(ex);
                return(View("Error"));
            }
        }
コード例 #2
0
        public async Task <ActionResult> XMLXL()
        {
            try
            {
                using (Stream xmlData = Assembly.GetExecutingAssembly().GetManifestResourceStream("Demo.xml"))
                {
                    Task <DocumentStoreResponse> documentTask = signatureServices.UploadXMLXLAsync(fileData: xmlData,
                                                                                                   contentLength: xmlData.Length,
                                                                                                   endUserMessage: END_USER_MESSAGE,
                                                                                                   generateQRHTMLImage: false,
                                                                                                   awaitForManualDestroy: MANUAL_DESTROY,
                                                                                                   signatureExpirationSecondstionSeconds: EXPIRATION_SECONDS);
                    DocumentStoreResponse document = await documentTask;

                    Session.Add(SESSION_DOC_ID, document.documentId);

                    return(File(System.Text.Encoding.UTF8.GetBytes(document.qrText),
                                System.Net.Mime.MediaTypeNames.Text.Plain));;
                }
            }
            catch (Exception ex)
            {
                return(new HttpStatusCodeResult(System.Net.HttpStatusCode.InternalServerError, Global.HandleError(ex)));
            }
        }