Exemplo n.º 1
0
        //public static WebCallResult PostCall(string url, string parameters, string host = null, int? port = null)
        //{
        //    var call = new WebCall(url, new Cookies(), host, port);
        //    call.Request.Method = "POST";
        //    call.Request.ContentType = "application/x-www-form-urlencoded";
        //    var data = Encoding.UTF8.GetBytes(parameters);
        //    call.Request.ContentLength = data.Length;
        //    using (var requestStream = call.Request.GetRequestStream())
        //        requestStream.Write(data, 0, data.Length);
        //    return call.MakeRequest(host, port);
        //}

        //public static WebCallResult Post(WebForm form, string host = null, int? port = null)
        //{
        //    var call = new WebCall(form.ActionUrl, form.Cookies, host, port);
        //    var request = call.Request;
        //    request.Method = "POST";
        //    request.ContentType = "application/x-www-form-urlencoded";
        //    var formRequest = form.GetRequest();
        //    request.ContentLength = formRequest.Length;
        //    request.Referer = form.OriginalUrl;
        //    request.GetRequestStream().Write(formRequest, 0, formRequest.Length);
        //    request.AllowAutoRedirect = false;
        //    return call.MakeRequest(host, port);
        //}

        private WebCallResult RedirectTo(string url, string host = null, int? port = null)
        {
            var call = new WebCall(url, Result.Cookies, host, port);

            var request = call.Request;
            request.Method = "GET";
            request.ContentType = "text/html";
            request.Referer = Request.Referer;

            return call.MakeRequest(host, port);
        }
Exemplo n.º 2
0
        public static WebCallResult MakeCall(string url, string host = null, int?port = null)
        {
            var call = new WebCall(url, new Cookies(), host, port);

            return(call.MakeRequest(host, port));
        }
Exemplo n.º 3
0
        public static WebCallResult MakeCall(string url, string host = null, int? port = null)
        {
            var call = new WebCall(url, new Cookies(), host, port);

            return call.MakeRequest(host, port);
        }