1

ブラウザで実行できる HTTP POST をコピーしようとしています。C#/WebRequest を使用して動作させることができません。

URL を呼び出すと、Fiddler で " 302 Found " 応答が返されます。これは、投稿されたデータが無効であるように思われます。

コピーしようとしている HTTP 投稿には、次のコンテンツ (Fiddler の TextView) があります。

------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="__EVENTTARGET"

ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$btnSend
------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="__EVENTARGUMENT"


------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="__VIEWSTATE"

/wEPDwULLTE3NTkzNDk2NjAPFgIeE1ZhbGlkYXRlUmVxdWVzdE1vZGUCARYCZg9kFgJmD2QWAmYPZBYCZg9kFgICAQ9kFgICAw8WAh4Fc3R5bGUFEnBvc2l0aW9uOnJlbGF0aXZlOxYCAgEPZBYEAgEPFgIeB2VuY3R5cGUFE211bHRpcGFydC9mb3JtLWRhdGEWCAIBD2QWAgIHD2QWAgIDD2QWCAIDDw8WAh4HVmlzaWJsZWhkZAIFDw8WAh4ITWFpbEd1aWQoKVhTeXN0ZW0uR3VpZCwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5JDI2Y2UwMjI2LTM1NDctNDY0MC05Y2UyLTkzZDNkMTcwZjU0Y2QWBgIBD2QWAmYPZBYOAgEPDxYCHgtOYXZpZ2F0ZVVybAUYL3Byb2ZpbC80MTA4MzQ4L0JldHRpbmFqZBYCZg8PFgIeBFRleHQFEUJldHRpbmFfaiwgMjQgw6VyZGQCAw9kFgJmDw8WAh4NQWx0ZXJuYXRlVGV4dGUWAh4KZ2FsbGVyeWltZwUCbm9kAgUPD2QWAh8BBSdwb3NpdGlvbjphYnNvbHV0ZTt0b3A6MjNweDtyaWdodD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D9Qcm9kdWN0R3JvdXBJRD0xJmd3PTgmZ3d0cmlnZ2VyPTQxMDgzNDhkZAIHD2QWBgIFDw8WAh8FBQ0vZmF2b3JpdGxpc3RlZGQCCQ8PFgIfBQUML29ubGluZWxpc3RlZGQCDw9kFgICAQ8PFgIfA2dkFgICAw8WAh4EaHJlZgUsamF2YXNjcmlwdDpkb1NlYXJjaCgnY3BoQ29udGVudF9kdGJTZWFyY2gnKTtkAg8PFgIfA2dkAhEPFgIfA2dkAgUPDxYCHwNnZGQYAQVIY3RsMDAkY3RsMDAkY3RsMDAkY3RsMDAkY3BoQ29udGVudCRjcGhNYWluJGNwaE1haW4kY3BoTWFpbiRTaG93SW50ZXJlc3QxDxQrAAJkArzg+gFk
------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="__EVENTVALIDATION"

/wEdAAx95zPpe2BlbkSPtSjnJkeSqvYfpfS3XNXzjmCqwTcmLQjHP/vbZXJQPtJKH09iDnpjSbMVDuj6latN4D+WJQ0GCMex73PUPLDd7cpHB4eUSvZX/tYXeQmcSauQTEcfDN4gzLbTMorrzQbwiAG5eIHPlTUVcvEvYPdgk6jbJTrWAjYX1hFGBRb9pN45cUrARCzIG4TG+xGWOKHjJPrtLGHRsD92s0QQ5wfKXLUKe9jk89T+K49gmSvDB5JCjlvQU0Q=
------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfRemoveFavoritID"


------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfAddFilterID"

4108348
------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfRemoveFilterID"


------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$tbSubject"

Test
------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$ceMessage$CkEditor1"

Test123
------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$MultiUpload$fuFallbackGalleryImageUpload"; filename=""
Content-Type: application/octet-stream


------WebKitFormBoundaryTbZqL4CZcQwC7K58--

これまでのところ、次の TextView を作成しました。

------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="__EVENTTARGET""

ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$btnSend
------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="__EVENTARGUMENT""


------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="__VIEWSTATE""

/wEPDwULLTE3NTkzNDk2NjAPFgIeE1ZhbGlkYXRlUmVxdWVzdE1vZGUCARYCZg9kFgJmD2QWAmYPZBYCZg9kFgICAQ9kFgICAw8WAh4Fc3R5bGUFEnBvc2l0aW9uOnJlbGF0aXZlOxYCAgEPZBYEAgEPFgIeB2VuY3R5cGUFE211bHRpcGFydC9mb3JtLWRhdGEWCAIBD2QWAgIHD2QWAgIDD2QWCAIDDw8WAh4HVmlzaWJsZWhkZAIFDw8WAh4ITWFpbEd1aWQoKVhTeXN0ZW0uR3VpZCwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5JDEwNGVkZjRmLTM4MTktNDc2Yi04ZDY4LTQ3OTc1ZmNjYzhhZmQWBgIBD2QWAmYPZBYOAgEPDxYCHgtOYXZpZ2F0ZV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hkFgJmD2QWAgIBDxYCHw8C/////w9kAg0PDxYCHwNoZGQCDw9kFgJmD2QWAgIBD2QWBgIBDw8WAh8FBRsva29udHJvbHBhbmVsL3Byb2ZpbGJpbGxlZGVkZAIDDw8WAh8FBRcva29udHJvbHBhbmVsL2ZvdG9hbGJ1bWRkAgUPDxYCHwUFGC9rb250cm9scGFuZWwvcHJvZmlsaW5mb2RkAhEPFgIfA2gWAmYPZBYCAgEPDxYCHwNoZGQCEw9kFgYCAQ8PFgIfBQVffi9VSS9Gb3Jtcy9Vc2Vycy9TYWxlcy9QdXJjaGFzZS9DaG9vc2VQcm9kdWN0R3JvdXAuYXNweD9Qcm9kdWN0R3JvdXBJRD0xJmd3PTgmZ3d0cmlnZ2VyPTQxMDcxOTdkZAIDDw8WAh8FBV9+L1VJL0Zvcm1zL1VzZXJzL1NhbGVzL1B1cmNoYXNlL0Nob29zZVByb2R1Y3RHcm91cC5hc3B4P1Byb2R1Y3RH
------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="__EVENTVALIDATION""

/wEdAAx3p75HULRe2VjfDQjIZMUyqvYfpfS3XNXzjmCqwTcmLQjHP/vbZXJQPtJKH09iDnpjSbMVDuj6latN4D+WJQ0GCMex73PUPLDd7cpHB4eUSvZX/tYXeQmcSauQTEcfDN4gzLbTMorrzQbwiAG5eIHPlTUVcvEvYPdgk6jbJTrWAjYX1hFGBRb9pN45cUrARCzIG4TG+xGWOKHjJPrtLGHRsD92s0QQ5wfKXLUKe9jk89T+K49gmSvDB5JCjlvQU0Q=
------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfRemoveFavoritID""


------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfAddFilterID""

4108031
------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfRemoveFilterID""


------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$tbSubject""

Hej :)
------------63f74b64334e4c8fad891bd1f969402b
Content-Disposition: form-data; name="Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$MultiUpload$fuFallbackGalleryImageUpload""

filename=
------------63f74b64334e4c8fad891bd1f969402b--

この投稿を作成するにはどうすればよいですか?

このガイドのヒント(FormUpload の回答)を使用しています。私の投稿データはこれで作られています:

var namValCollection = new Dictionary<string,string>();
    namValCollection.Add("Content-Disposition: form-data; name=\"__EVENTTARGET\"", "ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$btnSend");
    namValCollection.Add("Content-Disposition: form-data; name=\"__EVENTARGUMENT\"", string.Empty);
    namValCollection.Add("Content-Disposition: form-data; name=\"__VIEWSTATE\"", "/wEPDwULLTE3NTkzNDk2NjAPFgIeE1ZhbGlkYXRlUmVxdWVzdE1vZGUCARYCZg9kFgJmD2QWAmYPZBYCZg9kFgICAQ9kFgICAw8WAh4Fc3R5bGUFEnBvc2l0aW9uOnJlbGF0aXZlOxYCAgEPZBYEAgEPFgIeB2VuY3R5cGUFE211bHRpcGFydC9mb3JtLWRhdGEWCAIBD2QWAgIHD2QWAgIDD2QWCAIDDw8WAh4HVmlzaWJsZWhkZAIFDw8WAh4ITWFpbEd1aWQoKVhTeXN0ZW0uR3VpZCwgbXNjb3JsaWIsIFZlcnNpb249NC4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5JDEwNGVkZjRmLTM4MTktNDc2Yi04ZDY4LTQ3OTc1ZmN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8WAh8DaGQCBQ8WAh8DaBYCAgEPDxYCHwNoZGQCCw8PFgIfA2hkFgJmD2QWAgIBDxYCHw8C/////w9kAg0PDxYCHwNoZGQCDw9kFgJmD2QWAgIBD2QWBgIBDw8WAh8FBRsva29udHJvbHBhbmVsL3Byb2ZpbGJpbGxlZGVkZAIDDw8WAh8FBRcva29udHJvbHBhbmVsL2ZvdG9hbGJ1bWRkAgUPDxYCHwUFGC9rb250cm9scGFuZWwvcHJvZmlsaW5mb2RkAhEPFgIfA2gWAmYPZBYCAgEPDxYCHwNoZGQCEw9kFgYCAQ8PFgIfBQVffi9VSS9Gb3Jtcy9Vc2Vycy9TYWxlcy9QdXJjaGFzZS9DaG9vc2VQcm9kdWN0R3JvdXAuYXNweD9Qcm9kdWN0R3JvdXBJRD0xJmd3PTgmZ3d0cmlnZ2VyPTQxMDcxOTdkZAIDDw8WAh8FBV9+L1VJL0Zvcm1zL1VzZXJzL1NhbGVzL1B1cmNoYXNlL0Nob29zZVByb2R1Y3RHcm91cC5hc3B4P1Byb2R1Y3RH");
    namValCollection.Add("Content-Disposition: form-data; name=\"__EVENTVALIDATION\"", "/wEdAAx3p75HULRe2VjfDQjIZMUyqvYfpfS3XNXzjmCqwTcmLQjHP/vbZXJQPtJKH09iDnpjSbMVDuj6latN4D+WJQ0GCMex73PUPLDd7cpHB4eUSvZX/tYXeQmcSauQTEcfDN4gzLbTMorrzQbwiAG5eIHPlTUVcvEvYPdgk6jbJTrWAjYX1hFGBRb9pN45cUrARCzIG4TG+xGWOKHjJPrtLGHRsD92s0QQ5wfKXLUKe9jk89T+K49gmSvDB5JCjlvQU0Q=");
    namValCollection.Add("Content-Disposition: form-data; name=\"ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfRemoveFavoritID\"", string.Empty);
    namValCollection.Add("Content-Disposition: form-data; name=\"ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfAddFilterID\"", messages.Profile.ProfileId);
    namValCollection.Add("Content-Disposition: form-data; name=\"ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphLeftMenu$hfRemoveFilterID\"", string.Empty);
    namValCollection.Add("Content-Disposition: form-data; name=\"ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$tbSubject\"", messages.Subect);
    namValCollection.Add("Content-Disposition: form-data; name=\"ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$MultiUpload$fuFallbackGalleryImageUpload\"", "filename=");


    container.Add(new Cookie("DBED", "1") { Expires = DateTime.Now.AddHours(1), Domain = "domain.com" });
    container.Add(new Cookie("specialoffer", "1") { Expires = DateTime.Now.AddHours(1), Domain = "domain.com" });
    container.Add(new Cookie(".asdsad1024Auth", "3AE78C55993A13AC7374E51D91F6601408C151D0BD795DFAC41E056A737B858EE487C1F673925A1CA485AB0579C0E7EB3589C3036DAB9B549972904C6A7DBD480CsdE61E571F273B21B8861D5690ED7469815C8D4CD7EA68494D07FCD5054929432CF6093771D811A0F0DEAE53C0E69AE148CB2E1D0…") { Expires = DateTime.Now.AddHours(1), Domain = "dating.dk" });
    container.Add(new Cookie("ASP.NET_SessionId", "qin2ix2km0cpvtawphvjyupj") { Expires = DateTime.Now.AddHours(1), Domain = "domain.com" });
    container.Add(new Cookie("InfinityScrollPositions", "Userhome%3A600") { Expires = DateTime.Now.AddHours(1), Domain = "domain.com" });
    container.Add(new Cookie("__utma", "16287657.943558949.1379878207.1379878207.1379878207.1") { Expires = DateTime.Now.AddHours(1), Domain = "domain.com" });
    container.Add(new Cookie("__utmb", "__utmb=16287657.64.10.1379878207") { Expires = DateTime.Now.AddHours(1), Domain = "domain.com" });
    container.Add(new Cookie("InfinityScrollPositions", "Userhome%3A600") { Expires = DateTime.Now.AddHours(1), Domain = "domain.com" });

個人的には、問題は次のフィールドにあると思います。コピーする方法がわかりません。上記のコードでは、辞書に string.empty を追加しました。

これは、機能するブラウザ バージョンのフィールドです。

------WebKitFormBoundaryTbZqL4CZcQwC7K58
Content-Disposition: form-data; name="ctl00$ctl00$ctl00$ctl00$cphContent$cphMain$cphMain$userInfo$MultiUpload$fuFallbackGalleryImageUpload"; filename=""
Content-Type: application/octet-stream

誰かが興味を持っている場合は、次のコードを使用して投稿します。

 public static class FormUpload
    {
        private static readonly Encoding encoding = Encoding.UTF8;
        public static HttpWebResponse MultipartFormDataPost(string postUrl, string userAgent, Dictionary<string, string> postParameters, CookieContainer container)
        {
            string formDataBoundary = String.Format("----------{0:N}", Guid.NewGuid());
            string contentType = "multipart/form-data; boundary=" + formDataBoundary;

            byte[] formData = GetMultipartFormData(postParameters, formDataBoundary);

            return PostForm(postUrl, userAgent, contentType, formData, container);
        }
        private static HttpWebResponse PostForm(string postUrl, string userAgent, string contentType, byte[] formData, CookieContainer container)
        {
            HttpWebRequest request = WebRequest.Create(postUrl) as HttpWebRequest;

            if (request == null)
            {
                throw new NullReferenceException("request is not a http request");
            }

            // Set up the request properties.
            request.Method = "POST";
            request.ContentType = contentType;
            request.UserAgent = userAgent;
            request.CookieContainer = container;
            request.UserAgent =
                "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11";
            request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            request.Headers.Add("Accept-Encoding", "gzip,deflate,sdch");
            request.Headers.Add("Accept-Language", "en-US,en;q=0.8,da;q=0.6");

            request.Headers.Add("Cache-Control", "max-age=0");
            request.ContentLength = formData.Length;

            // You could add authentication here as well if needed:
            // request.PreAuthenticate = true;
            // request.AuthenticationLevel = System.Net.Security.AuthenticationLevel.MutualAuthRequested;
            // request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.Encoding.Default.GetBytes("username" + ":" + "password")));

            // Send the form data to the request.
            using (Stream requestStream = request.GetRequestStream())
            {
                requestStream.Write(formData, 0, formData.Length);
                requestStream.Close();
            }

            return request.GetResponse() as HttpWebResponse;
        }

        private static byte[] GetMultipartFormData(Dictionary<string, string> postParameters, string boundary)
        {
            Stream formDataStream = new System.IO.MemoryStream();
            bool needsCLRF = false;

            foreach (var param in postParameters)
            {
                // Thanks to feedback from commenters, add a CRLF to allow multiple parameters to be added.
                // Skip it on the first parameter, add it to subsequent parameters.
                if (needsCLRF)
                    formDataStream.Write(encoding.GetBytes("\r\n"), 0, encoding.GetByteCount("\r\n"));

                needsCLRF = true;

                    string postData = string.Format("--{0}\r\nContent-Disposition: form-data; name=\"{1}\"\r\n\r\n{2}",
                        boundary,
                        param.Key,
                        param.Value);
                    formDataStream.Write(encoding.GetBytes(postData), 0, encoding.GetByteCount(postData));

            }

            // Add the end of the request.  Start with a newline
            string footer = "\r\n--" + boundary + "--\r\n";
            formDataStream.Write(encoding.GetBytes(footer), 0, encoding.GetByteCount(footer));

            // Dump the Stream into a byte[]
            formDataStream.Position = 0;
            byte[] formData = new byte[formDataStream.Length];
            formDataStream.Read(formData, 0, formData.Length);
            formDataStream.Close();

            return formData;
        }

        public class FileParameter
        {
            public byte[] File { get; set; }
            public string FileName { get; set; }
            public string ContentType { get; set; }
            public FileParameter(byte[] file) : this(file, null) { }
            public FileParameter(byte[] file, string filename) : this(file, filename, null) { }
            public FileParameter(byte[] file, string filename, string contenttype)
            {
                File = file;
                FileName = filename;
                ContentType = contenttype;
            }
        }
    }

わかりました、たくさんのコードとテキスト。multipart/form-data を使用して HTTP 投稿を作成した経験がある人なら、おそらく何らかのヒントを得ることができるでしょう。「302が見つかりました」はヒントかもしれませんが、わかりません。

私を方向に向けることができるどんな助けも大歓迎です!

4

1 に答える 1