# How to launch a new request from an external Application

**URL:** <https://discuss.workflowgen.com/t/how-to-launch-a-new-request-from-an-external-application/1199>\
**Category:** General WorkflowGen Discussion\
**Created:** [October 31, 2018, 2:00pm UTC](https://discuss.workflowgen.com/t/how-to-launch-a-new-request-from-an-external-application/1199 "2018-10-31T14:00:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon.breeze](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@simon.breeze](https://discuss.workflowgen.com/u/simon.breeze)\
**Post date:** [October 31, 2018, 2:00pm UTC](https://discuss.workflowgen.com/t/how-to-launch-a-new-request-from-an-external-application/1199/1 "2018-10-31T14:00:30Z")

</div>

Hi,

My goal is to create a whole raft of New requests based on the data held in our old workflow system. So I will want to loo through my old requests and for each one raise a new WFGen request and populate some of the data.

If I use a link in a web browser I can successfully create a blank new request. What I really need is to pass it a context as well so fields will be populated and do this from c# code within a for each loop.

My issue appears to be finding the right credentials to use. If I use my windows logon and password I get an authentication message. That surprised me because when I use the url without any credentials it must surely be using windows authentication.

The code I have used is pretty much a copy of the code in the Documentation with a couple of minor changes to allow it to be run from a windows form rather than a web procedure.

Here is a snippet of what I am trying

```
       ContextParameters myCPs = new ContextParameters();
        ContextParameter myParam = new ContextParameter();
        myParam.Name = "SELLECT_EMPLOYEE_TXTEMPLOYEENAME";
        myParam.Value = "Simon Breeze";
        myParam.Direction = ContextParameter.Directions.In;
        myCPs.Add(myParam);
        myCPs.Update();
        string myContext = myCPs.GetXml();

        string apURL = Url + "&L=" + Language + "&ProcessName=" + ProcessName
            + "&RequesterName=simon.breeze&Test=" + Test;
        System.Net.NetworkCredential mycred = new System.Net.NetworkCredential
                (UserName, Password, UserDomain);
        System.Net.CredentialCache myCache = new System.Net.CredentialCache();
        myCache.Add(new Uri(Url),"Basic",mycred);

        //Prepare request
        System.Net.HttpWebRequest httpWebReq = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(apURL);
        httpWebReq.Method = "Post";

        //Set Authentication
        httpWebReq.Credentials = myCache;

        //Set Context info
        string postData = "CONTEXT=" + WebUtility.UrlEncode(myContext);
        System.Text.ASCIIEncoding encoding = new ASCIIEncoding();
        Byte[] Buffer = encoding.GetBytes(postData);

        //Set the contenttype of the data being posted
        httpWebReq.ContentType = "application/x-www-form-urlencoded";
        httpWebReq.ContentLength = postData.Length;

        //Send the context
        System.IO.Stream myStream = httpWebReq.GetRequestStream();
        myStream.Write(Buffer, 0, Buffer.Length);
        myStream.Close();
        HttpWebResponse httpWebResp = null ;

        try
        {
             httpWebResp = (System.Net.HttpWebResponse)httpWebReq.GetResponse();
        }
        catch(WebException ex)
        {
            MessageBox.Show(ex.ToString());
        }

```

Thanks

Simon

---

<div class="post-metadata">

**Author:** ![eddy.daouk](https://yyz2.discourse-cdn.com/flex030/user_avatar/discuss.workflowgen.com/eddy.daouk/32/672_2.png) [@eddy.daouk](https://discuss.workflowgen.com/u/eddy.daouk)\
**Post date:** [December 18, 2018, 4:26pm UTC](https://discuss.workflowgen.com/t/how-to-launch-a-new-request-from-an-external-application/1199/2 "2018-12-18T16:26:03Z")

</div>

Hi @simon.breeze,

Please refer to this article if you would like to launch a new request via URL with context parameters:

> [@How to launch a new request with context parameters from an external application via a URL](https://discuss.workflowgen.com/t/how-to-launch-a-new-request-with-context-parameters-from-an-external-application-via-a-url/326):
>
> This procedure lets you launch a new process from another application using SDK-style parameters. Notes The process to be launched must be a public access level sub-process. This solution is not available with WorkflowGen Standard and StandardOne licenses in version 5. URL Use the URL http://[myserver]/wfgen/show.aspx?QUERY=PROCESS\_START\_REMOTE, replacing [myserver] with the name of your server. Required parameters PROCESS Type: String Description: Name of process to launch TEST…

Regards,  
Eddy.
