コード例 #1
0
ファイル: WebCall.cs プロジェクト: WELL-E/Hurricane
        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();
        }
コード例 #2
0
ファイル: WebCall.cs プロジェクト: WELL-E/Hurricane
        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();
        }
コード例 #3
0
ファイル: WebCall.cs プロジェクト: WELL-E/Hurricane
        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();
        }
コード例 #4
0
ファイル: WebCall.cs プロジェクト: WELL-E/Hurricane
        public static WebCallResult MakeCall(string url)
        {
            var call = new WebCall(url, new Cookies());

            return call.MakeRequest();
        }