private void DetectMethod(string authToken)
        {
            TranslatorService.LanguageServiceClient client = new TranslatorService.LanguageServiceClient();
            //Set Authorization header before sending the request
            HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();

            httpRequestProperty.Method = "POST";
            httpRequestProperty.Headers.Add("Authorization", authToken);
            using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
            {
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
                //Below line will return the code of the detected language.
                string[] strDetectedLangCode = { client.Detect("", txtUser.Text) };
                detectedLangCode = strDetectedLangCode[0];
                //Fetch the name of the detected language using the code.
                string[] strDetectedLang = client.GetLanguageNames("", "en", strDetectedLangCode, true);
                lblDetectedText.Text = strDetectedLang[0];

                //Fetching the list of supported languages and binding to the dropdown list.
                languagesForTranslate = client.GetLanguagesForTranslate("");
                allLang = client.GetLanguageNames("", "en", languagesForTranslate, true);
                drpAllLang.DataSource = allLang;
                drpAllLang.DataBind();
            }
        }
        private void TranslateMethod(string auToken)
        {
            TranslatorService.LanguageServiceClient client = new TranslatorService.LanguageServiceClient();
            //Set Authorization header before sending the request
            HttpRequestMessageProperty httpRequestProperty = new HttpRequestMessageProperty();

            httpRequestProperty.Method = "POST";
            httpRequestProperty.Headers.Add("Authorization", auToken);
            // Creates a block within which an OperationContext object is in scope.
            using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
            {
                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
                string translationResult;
                languagesForTranslate = client.GetLanguagesForTranslate("");
                detectedLangCode      = client.Detect("", txtUser.Text);
                translationResult     = client.Translate("", txtUser.Text, detectedLangCode, languagesForTranslate[drpAllLang.SelectedIndex], "text/html", "general", "");
                txtTranslated.Text    = translationResult;
            }
        }