demellor

iFrame in C# forms application

0 votes

Is there an example of how to have an iframe appear in the C# application?  I want to create a transaction and then display it for the sender in an iframe to finish the process

Richard DeMello


Reply to: iFrame in C# forms application

0 votes

Hi Richard,

 

Kindly refer to this blog "OneSpan Sign How To: Creating a ASP.NET MVC Web Application", you can find the original code share here. And I've attached a recompiled version referring to a greater version .NET SDK.

And as a shorter answer, you could present an iFrame with below syntax in your .cshtml file:
<div align="center">
    <iframe src="@String.Concat("http://sandbox.esignlive.com/access?sessionToken=", @ViewData["token"])" width="1000" height="700" scrolling="yes"></iframe>
</div>
 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: iFrame in C# forms application

0 votes

Since my application is a Windows forms application I guess instead of the iframe I can just use a browser control.  We use FedRAMP SSO and using the code below I get the transcation created by the URL only takes me to A2.  Can I use a URL for this or because we are SSO with FedRAMP will that not work.

 

URL created to display the transaction that takes me to A2:  https://sandbox-gov.esignlive.com/access?sessionToken=@ViewData[ZDY5M2UwMmEtODhlNC00YzZjLWFjMjEtNWY3NTc2MWYwMTJi]

 

    GlobalVars.CurrentapiKey = GlobalVars.arrUserAPIKey[cbUsers5.SelectedIndex];
            GlobalVars.CurrentapiUrl = GlobalVars.arrURLs[cbEnvironments8.SelectedIndex];
            OssClient oClient = new OssClient(GlobalVars.CurrentapiKey, GlobalVars.CurrentapiUrl);

            FileStream fs = File.OpenRead("C:\\Temp\\Test_Summary.pdf");

            DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("Test Package .NET6")
                    .WithSettings(DocumentPackageSettingsBuilder
                        .NewDocumentPackageSettings())
                    .WithSigner(SignerBuilder
                        .NewSignerWithEmail("[email protected]")
                        .WithFirstName("Signer First Name")
                        .WithLastName("Signer Last Name")
                        .WithCustomId("Signer"))
                    .WithSigner(SignerBuilder
                        .NewSignerWithEmail("[email protected]")
                        .WithFirstName("Your First Name")
                        .WithLastName("Your Last Name"))
                    .WithDocument(DocumentBuilder.NewDocumentNamed("sampleAgreement")
                            .FromStream(fs, DocumentType.PDF)
                            .WithSignature(SignatureBuilder
                                    .SignatureFor("[email protected]")
                                    .OnPage(0)
                                    .AtPosition(175, 165))
                            .WithSignature(SignatureBuilder
                                    .SignatureFor("[email protected]")
                                    .OnPage(0)
                                    .AtPosition(550, 165))
                                  )
                    .Build();

            PackageId packageId = oClient.CreatePackageOneStep(superDuperPackage);
            string Senderst = oClient.AuthenticationTokenService.CreateSenderAuthenticationToken(packageId);
            string newURLstr = "https://sandbox-gov.esignlive.com/access?sessionToken=@ViewData[" + Senderst + "]";
            TBBrowser.Url= new Uri(newURLstr);
            Console.WriteLine(newURLstr);
            //newURLstr value was:  https://sandbox-gov.esignlive.com/access?sessionToken=@ViewData[ZDY5M2UwMmEtODhlNC00YzZjLWFjMjEtNWY3NTc2MWYwMTJi]

Richard DeMello


Reply to: iFrame in C# forms application

0 votes

Hi Richard,

 

Try adding "signer-" upfront the API url: 

https://signer-sandbox-gov.esignlive.com/access?sessionToken=@ViewData[ZDY5M2UwMmEtODhlNC00YzZjLWFjMjEtNWY3NTc2MWYwMTJi]

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: iFrame in C# forms application

0 votes

I updated the code to use the URL below and got the following error

https://signer-sandbox-gov.esignlive.com/access?sessionToken=@ViewData[NWJjOWRiODctMzEzOC00YWMxLWJjZTUtYWVmMDFmOTYxNDdh]

Error displayed:

Unauthorized Access

Your authenication token was incorrect.

 

The transaction is created was:  5xdG_8teu_NI4L20CpNYrIkg6cE=

I do use Subaccounts.  Do I need to do something to set up things for the token to work so the sender can see the transaction and make their final edits.  It's a draft after I create it beacuse I don't send it.

Richard DeMello


Reply to: iFrame in C# forms application

0 votes

Hi Richard,

 

From your description, it sounds like you want to embed the designer page (for sender to make their final edits) vs signing ceremony (for signers to sign), in which case, you need to build below link instead:
 

https://signer-sandbox-gov.esignlive.com/auth?senderAuthenticationToken={sender_auth_token}&target=https://signer-sandbox-gov.esignlive.com/a/transaction/{package_id}/designer?profile=default

 

You can find the detailed steps to generate a sender authentication token in this guide.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: iFrame in C# forms application

0 votes

I used the information in the authentication token guide and related calls to generate the URL below

 

URL:  https://sandbox.esignlive.com/auth?senderAuthenticationToken=ZWU5MDcxYWMtNzFkYi00NmE5LThjYmItMjE2ZjZkOGQ2OGMw&target=https://sandbox.esignlive.com/a/transaction/WeK0hB1I9_faQC3XSMplk6ExYw8=/designer

 

I get an error

 

Access Denied

Your authentication token was incorrect.

 

I get it for both transactions in the main account and those in subaccounts.

 

                PackageId packageId = new PackageId("WeK0hB1I9_faQC3XSMplk6ExYw8="); //main account
                string Senderst = oClient.AuthenticationTokenService.CreateSenderAuthenticationToken(packageId);

                //Used to display designer screen
                string newURLstr = "https://sandbox.esignlive.com/auth?senderAuthenticationToken=" + Senderst + "&target=https://sandbox.esignlive.com/a/transaction/" + packageId.ToString() + "/designer";
                TBBrowser.Url = new Uri(newURLstr);
                UpdateStatus("URL:  "+newURLstr);
                UpdateStatus("Displaying Transaction For Editing!");

 

I tried wrong API information and different settings which gave me other errors so I'm fairly sure this is the right environment.

 

Any suggestions?  Do you think our use of Subaccounts is impacting my results?

Richard DeMello


Reply to: iFrame in C# forms application

0 votes

Hi Richard,

 

Just had a quick check with support team, and seems this package "WeK0hB1I9_faQC3XSMplk6ExYw8=" was created in the FedRAMP sandbox environment (https://signer-sandbox-gov.esignlive.com) by your email [email protected], who's the owner of the main account.

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: iFrame in C# forms application

0 votes

I am the account owner.   I guess we may also have an issue because we use subaccounts?

Richard DeMello


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off