//### callback check for Sample39 public ActionResult sample40_callback() { // Get user info String infoFile = AppDomain.CurrentDomain.BaseDirectory + "user_info.txt"; System.IO.StreamReader userInfoFile = new System.IO.StreamReader(infoFile); String clientId = userInfoFile.ReadLine(); String privateKey = userInfoFile.ReadLine(); userInfoFile.Close(); // Check is data posted if (Request.HttpMethod == "POST") { System.IO.StreamReader reader = new System.IO.StreamReader(Request.InputStream); String jsonString = reader.ReadToEnd(); var data = System.Web.Helpers.Json.Decode(jsonString); var serializedData = System.Web.Helpers.Json.Decode(data.SerializedData); String formGuid = data.SourceId; formGuid = formGuid.Replace(" ", ""); String participantGuid = serializedData.ParticipantGuid; participantGuid = participantGuid.Replace(" ", ""); String jobStatus = data.Eventtype; jobStatus = jobStatus.Replace(" ", ""); // Create service for Groupdocs account GroupdocsService service = new GroupdocsService("https://api.groupdocs.com/v2.0", clientId, privateKey); //Make request to api for get document info by job id if (jobStatus.Equals("JobCompleted")) { Groupdocs.Api.Contract.Signature.SignatureFormParticipantResponse getDocInfo = service.PublicGetFormParticipant(formGuid, participantGuid); if (getDocInfo.Status.Equals("Ok")) { String guid = getDocInfo.Result.Participant.SignedDocuments[0].DocumentGuid; //path to settings file - temporary save clientId and apiKey like to property file String callbackInfo = AppDomain.CurrentDomain.BaseDirectory + "callback_info.txt"; //open file in rewrite mode FileStream fcreate = System.IO.File.Open(callbackInfo, FileMode.Create); // will create the file or overwrite it if it already exists //String filePath = AppDomain.CurrentDomain.BaseDirectory + "user_info.txt"; System.IO.StreamWriter infoFileStreamWriter = new StreamWriter(fcreate); //w = System.IO.File.CreateText(filePath); infoFileStreamWriter.WriteLine(guid); //save clientId infoFileStreamWriter.Flush(); infoFileStreamWriter.Close(); } } return View("sample40_callback"); } // If data not posted return to template for filling of necessary fields else { return View("sample40_callback"); } }