Example #1
0
        private WebCallResult RedirectTo(string url)
        {
            var call = new WebCall(url, Result.Cookies);

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

            return call.MakeRequest();
        }
Example #2
0
        public static WebCallResult PostCall(string url, string parameters)
        {
            var call = new WebCall(url, new Cookies())
            {
                Request = {Method = "POST", 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();
        }
Example #3
0
        public static WebCallResult Post(WebForm form)
        {
            var call = new WebCall(form.ActionUrl, form.Cookies);

            var request = call.Request;
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            var formRequest = form.GetRequest();
            request.ContentLength = formRequest.Length;
            request.GetRequestStream().Write(formRequest, 0, formRequest.Length);
            request.AllowAutoRedirect = false;
            request.Referer = form.OriginalUrl;

            return call.MakeRequest();
        }
Example #4
0
        public static WebCallResult MakeCall(string url)
        {
            var call = new WebCall(url, new Cookies());

            return call.MakeRequest();
        }