private mvc.ActionResult CreateDocumentAndRedirect(ProxyAuthRequestResult req, JObject jArgs, Guid instanceId) { var fSvc = SvcBldr.FormsV2(); var cdsr = fSvc.CreateDocument(new FormDocumentCreateArgs { IsTemporary = true, FormTemplateId = new Guid(jArgs["FormTemplateId"].Value <string>()) //Convert failure when .Value<Guid> is used. }); ExceptionsML.Check(cdsr.Error); var vrId = Functions.NewSeq(); jArgs["DocumentVersionId"] = cdsr.Result.Version.Id; jArgs["FormRequestId"] = req.Id; jArgs["ViewRequestId"] = vrId; jArgs["UseRecaptcha"] = false; ExceptionsML.Check(cdsr.Error); var secSvc = SvcBldr.SecurityV2(); var viewerCPR = new ProxyAuthRequest { Id = vrId, ExpirationType = ExpirationMode.CustomCount, ExpirationValue = "1", //Expires as soon as the form is submitted. RequestType = ProxyAuthRequestType.AccessViewer, Token = req.Token, Parameters = JsonConvert.SerializeObject(jArgs) }; var cprSR = secSvc.CreateProxyRequest(viewerCPR); ExceptionsML.Check(cprSR.Error); var fsc = GuestSessionCookie.Create(Response, cprSR.Result, instanceId, req.Id); return(RedirectToAction("Index", fsc)); }