Skip to main content

Create and Send Session Variable to External Page

Comments

2 comments

  • Permanently deleted user

    You want to send some information (long session information in your case) to the external web server by HTTP POST method, right?

    This is what I did for one project.

    (1) Modify Viewer.html of the GVS, by adding your own <form/> inside <body/> under the existing <form id="form1"/>.

         For example,

    <body>

     

     <form id="form1">

     ... This is the exsting section to refer GVS...

     </form>

     <!-- This new Form block is required for posting the YOUR OWN data to the External Web server.-->

     

     <form id="customForm" method="post" name="customForm" action="" target="_top">

     

      <div style="display: none">

     

      <textarea id="customData" name="customData" cols="50" rows="8" style="display: none; visibility: hidden">

     

      </textarea>

     

     </div>

     

     </form>

     

    </body>

    (2) Implement a custom External Activity, where posts your data using the custom <form/> on viewer.html

    for example,

     public void WebPostToExternal(ActivityContext context)

     

            {

     

                try

     

                {

     

                    string uriToPost = context.GetValue("Uri") as string;

     

                    string dataToPost = context.GetValue("Data") as string;

                    Uri callbackUri = new Uri(uriToPost);

     

                   

     

                    var doc = HtmlPage.Document;

     

                    var form = doc.GetElementById("customForm");

     

                    var data = doc.GetElementById("customData");

     

                   

     

                    data.SetProperty("value", dataToPost);

     

                    form.SetProperty("action", callbackUri);

     

                    form.Invoke("submit");

                    context.SetValue("IsCompleted", true);

     

                }

     

                catch (Exception e)

     

                {

     

      //... Add some logging information here

     

      

                    context.SetValue("IsCompleted", false);

     

                }

     

                finally

     

                {

     

                    context.CompleteActivity();

     

                }

     

            }

    *** Check  a QuickStart to learn how to build a custom Module where I implemented above custom external activity.

    0
  • Permanently deleted user
    I have looked into the above code, got a question from me: I am using geocortex html5viwer and trying to build a custom activity into geocortex workflow designer to get hidden field from a html page. In custom activity library, can we add reference System.Windows.Browser into the project in order to use htmlPage class. To me. htmlPage class is only for silverlight object, can we use this custom activity which references to htmlpage in html5 viewer?  Any input are highly appreciated.
    0

Please sign in to leave a comment.