public IPttRequest RequestWithCaptchaValue(IPttRequest request, IPttCaptcha pttCaptcha) { if (_extensiveLoggingNeeded) { Logger.LogProcess("TezCaptcha RequestWithCaptchaValue captcha coming:" + pttCaptcha.ToString()); } var pttRequestFactory = new PttRequestFactory(request); var newRequest = pttRequestFactory.Deserialize( string.Format("<Request><Url>{0}</Url><Referer>{1}</Referer><Method>POST</Method></Request>", "http://www.tez-tour.com/captcha/check.htm", "http://www.tez-tour.com/captcha/index.htm?locale=ru&pr=s&ref=http://www.tez-tour.com/search.html" )); newRequest.WrappedRequest.AllowAutoRedirect = false; newRequest.WrappedRequest.Timeout = newRequest.WrappedRequest.Timeout * 4; newRequest.WrappedRequest.ReadWriteTimeout = newRequest.WrappedRequest.ReadWriteTimeout * 4; newRequest.WrappedRequest.ServicePoint.ConnectionLeaseTimeout = newRequest.WrappedRequest.Timeout; newRequest.WrappedRequest.ServicePoint.MaxIdleTime = newRequest.WrappedRequest.Timeout; var captchaImageUri = new Uri(pttCaptcha.Url); var captchaFileNameWithExtension = Path.GetFileNameWithoutExtension(captchaImageUri.AbsolutePath); var captchaUrl = pttCaptcha.FormUrl; var hashStart = captchaUrl.IndexOf("#"); if (hashStart > -1) captchaUrl = captchaUrl.Substring(hashStart); captchaUrl = HttpUtility.UrlEncode(HttpUtility.UrlEncode(captchaUrl)); if (_extensiveLoggingNeeded) { Logger.LogProcess("TezCaptcha RequestWithCaptchaValue captchaurl parsed:" + captchaUrl); } newRequest.PostValue = string.Format("image={0}&ref={3}&pr=s&hashRef={2}&answer={1}&submit=%D0%AF+%D0%BD%D0%B5+%D1%80%D0%BE%D0%B1%D0%BE%D1%82%21", captchaFileNameWithExtension, pttCaptcha.Value, captchaUrl, "http%3A%2F%2Fwww.tez-tour.com%2Fsearch.html"); newRequest.WrappedRequest.ContentType = "application/x-www-form-urlencoded"; return newRequest; }