public ActionResult Sample18()
        {
            // Check is data posted
            if (Request.HttpMethod == "POST")
            {
                //### Set variables and get POST data
                System.Collections.Hashtable result = new System.Collections.Hashtable();
                String clientId = Request.Form["clientId"];
                String privateKey = Request.Form["privateKey"];
                String fileId = Request.Form["fileId"];
                String convertType = Request.Form["convertType"];
                String url = Request.Form["url"];
                var file = Request.Files["file"];
                String callbackUrl = Request.Form["callbackUrl"];
                String iframe = "";
                // Set entered data to the results list
                result.Add("clientId", clientId);
                result.Add("privateKey", privateKey);
                result.Add("fileId", fileId);
                result.Add("type", convertType);

                if (!String.IsNullOrEmpty(callbackUrl))
                {
                    result.Add("callbackUrl", callbackUrl);
                }

                String message = null;
                // Check is all required fields were provided
                if (String.IsNullOrEmpty(clientId) || String.IsNullOrEmpty(privateKey) || String.IsNullOrEmpty(convertType)
                    || (String.IsNullOrEmpty(fileId) && (String.IsNullOrEmpty(url)) && (file.ContentLength == 0)))
                {
                    // If not all required fields were provided - send error message
                    message = "Please enter all parameters";
                    result.Add("error", message);
                    return View("Sample18", null, result);
                }
                else
                {

                    //path to settings file - temporary save clientId and apiKey like to property file
                    create_info_file(clientId, privateKey, "");

                    String basePath = Request.Form["basePath"];
                    //Check is base path entered
                    if (basePath.Equals(""))
                    {
                        //If base path empty set base path to the dev server
                        basePath = "https://api.groupdocs.com/v2.0";
                    }
                    result.Add("basePath", basePath);
                    // Create service for Groupdocs account
                    GroupdocsService service = new GroupdocsService(basePath, clientId, privateKey);

                    //if URL to web file was provided - upload the file from Web and get it's GUID
                    if (url != "")
                    {
                        //Make request to upload file from entered Url
                        String guid = service.UploadUrl(url);
                        if (guid != null)
                        {
                            //If file uploaded return his GuId
                            fileId = guid;

                        }
                        //If file wasn't uploaded return error
                        else
                        {
                            result.Add("error", "Something wrong with entered data");
                            return View("Sample18", null, result);
                        }
                    }

                    //if file was uploaded locally - upload the file and get it's GUID
                    if (file.FileName != "")
                    {
                        //Upload local file
                        Groupdocs.Api.Contract.UploadRequestResult upload = service.UploadFile(file.FileName, String.Empty, file.InputStream);
                        if (upload.Guid != null)
                        {
                            //If file uploaded return his guid
                            fileId = upload.Guid;
                        }
                        else
                        {
                            //If file wasn't uploaded return error
                            result.Add("error", "Something wrong with entered data");
                            return View("Sample18", null, result);
                        }
                    }

                    decimal jobId = 0;
                    try
                    {
                        //Make request to api for convert file.
                        //@fileId - GUID. Represents the provided file - via guid, web url or local file.
                        //@type - File type of the result file
                        //@callbackUrl - callbackUrl URL
                        jobId = service.ConvertFile(fileId, convertType, "", false, false, callbackUrl);
                    }
                    catch (Exception e)
                    {

                        result.Add("error", e.ToString());
                        return View("Sample18", null, result);
                    }

                    /*
                     * The approack bellow is not good one to get Job Results directly in the code after ConvertFile method.
                     * We use this approach to show the result file in embedded iframe on the same sample page.
                     * In production it's better to use callbackUrl approach - this approach allso implemented in this sample.
                     */

                    //Delay is required to be shure that the file was processed
                    System.Threading.Thread.Sleep(5000);
                    //Make request to api to get document info by job id
                    Groupdocs.Api.Contract.GetJobDocumentsResult job = service.GetJobDocuments(jobId);

                    if (job.Inputs[0].Outputs[0].Guid != "")
                    {
                        // Generate Embed viewer url with entered file id
                        if (basePath.Equals("https://api.groupdocs.com/v2.0"))
                        {
                            iframe = "https://apps.groupdocs.com/document-viewer/embed/" + job.Inputs[0].Outputs[0].Guid;
                        }
                        if (basePath.Equals("https://dev-api-groupdocs.dynabic.com/v2.0"))
                        {
                            iframe = "https://dev-apps-groupdocs.dynabic.com/document-viewer/embed/" + job.Inputs[0].Outputs[0].Guid;
                        }
                        if (basePath.Equals("https://stage-api-groupdocs.dynabic.com/v2.0"))
                        {
                            iframe = "https://stage-api-groupdocs.dynabic.com/document-viewer/embed/" + job.Inputs[0].Outputs[0].Guid;
                        }
                        if (basePath.Equals("https://realtime-api.groupdocs.com/v2.0"))
                        {
                            iframe = "https://realtime-apps.groupdocs.com/document-viewer/embed/" + job.Inputs[0].Outputs[0].Guid;
                        }
                        iframe = Groupdocs.Security.UrlSignature.Sign(iframe, privateKey);
                        result.Add("iframe", iframe);
                        //Return file guid to the template
                        result.Add("guid", job.Inputs[0].Outputs[0].Guid);
                        return View("Sample18", null, result);
                    }
                    else
                    {
                        //If file GuId is empty return error
                        result.Add("error", "File GuId is empty");
                        return View("Sample18", null, result);
                    }

                }

            }
            // If data not posted return to template for filling of necessary fields
            else
            {
                return View("Sample18");
            }
        }