{"id":758,"date":"2023-09-10T19:24:48","date_gmt":"2023-09-10T10:24:48","guid":{"rendered":"https:\/\/mvc.auctionpro.co.kr\/?page_id=758"},"modified":"2023-09-12T10:49:42","modified_gmt":"2023-09-12T01:49:42","slug":"netcore-httpclient","status":"publish","type":"page","link":"https:\/\/mvc.auctionpro.co.kr\/?page_id=758","title":{"rendered":"NetCore  :  HttpClient"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Overview: <\/h2>\n\n\n\n<p>\uc2ec\uac01\ub3c4 \ucf54\ub4dc \uc124\uba85 \ud504\ub85c\uc81d\ud2b8 \ud30c\uc77c \uc904 \ube44\ud45c\uc2dc \uc624\ub958(Suppression) \uc0c1\ud0dc<br>\uacbd\uace0 SYSLIB0014 &#8216;WebRequest.Create(string)&#8217;\uc740(\ub294) \uc0ac\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<br>&#8216;WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.&#8217;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/mvc.auctionpro.co.kr\/wp-content\/uploads\/2023\/09\/image.png\" alt=\"\" class=\"wp-image-759\" style=\"width:931px;height:460px\" width=\"931\" height=\"460\" srcset=\"https:\/\/mvc.auctionpro.co.kr\/wp-content\/uploads\/2023\/09\/image.png 933w, https:\/\/mvc.auctionpro.co.kr\/wp-content\/uploads\/2023\/09\/image-300x148.png 300w, https:\/\/mvc.auctionpro.co.kr\/wp-content\/uploads\/2023\/09\/image-768x379.png 768w\" sizes=\"auto, (max-width: 931px) 100vw, 931px\" \/><\/figure>\n\n\n\n<p>\ucc38\uc870 : https:\/\/learn.microsoft.com\/ko-kr\/dotnet\/core\/compatibility\/networking\/6.0\/webrequest-deprecated<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"> \ubcc0\uacbd \ub0b4\uc6a9 \uc124\uba85<\/h2>\n\n\n\n<p>WebRequest,&nbsp;WebClient,&nbsp;ServicePoint&nbsp;\ud074\ub798\uc2a4\ub294 .NET Core \ubc84\uc804 2.0\uc5d0\uc11c \uc774\uc804 \ubc84\uc804\uacfc\uc758 \ud638\ud658\uc131\uc744 \uc704\ud574 \ucd94\uac00\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \uc774\ub4e4 \ud074\ub798\uc2a4\ub294&nbsp;WebRequest.GetRequestStream\uc774 \uc751\ub2f5 \uc804\uccb4\uc5d0 \ub300\ud574 \uba54\ubaa8\ub9ac\ub97c \ud560\ub2f9\ud558\uace0&nbsp;WebClient.CancelAsync\uac00 \uc989\uc2dc \ucde8\uc18c\ub418\uc9c0 \uc54a\ub294 \uacbd\uc6b0\uac00 \ubc1c\uc0dd\ud558\ub294 \ub4f1 \uba87 \uac00\uc9c0 \ud638\ud658\uc131\uc774 \uc190\uc0c1\ub418\ub294 \ub7f0\ud0c0\uc784 \ubcc0\uacbd\uc744 \uc57c\uae30\ud588\uc2b5\ub2c8\ub2e4.<\/p>\n\n\n\n<p>.NET 6\ubd80\ud130&nbsp;WebRequest,&nbsp;WebClient,&nbsp;ServicePoint&nbsp;\ud074\ub798\uc2a4\ub294 \ub354 \uc774\uc0c1 \uc0ac\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ud074\ub798\uc2a4\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc740 \uac00\ub2a5\ud558\uc9c0\ub9cc, \uc0c8\ub85c\uc6b4 \uac1c\ubc1c\uc5d0\uc11c\ub294 \uad8c\uc7a5\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ubd84\uc11d\uae30 \uacbd\uace0\uc758 \uac1c\uc218\ub97c \uc904\uc774\uae30 \uc704\ud574 \uad6c\ubb38 \uba54\uc11c\ub4dc\ub9cc&nbsp;ObsoleteAttribute&nbsp;\ud2b9\uc131\uc73c\ub85c \ub370\ucf54\ub808\uc774\ud2b8\ub429\ub2c8\ub2e4.<\/p>\n\n\n\n<p><a href=\"https:\/\/learn.microsoft.com\/ko-kr\/dotnet\/core\/compatibility\/networking\/6.0\/webrequest-deprecated#recommended-action\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"recommended-action\">\uad8c\uc7a5 \uc870\uce58<\/h2>\n\n\n\n<p>\ub300\uc2e0&nbsp;<a href=\"https:\/\/learn.microsoft.com\/ko-kr\/dotnet\/api\/system.net.http.httpclient\">System.Net.Http.HttpClient<\/a>&nbsp;\ud074\ub798\uc2a4\ub97c \uc0ac\uc6a9\ud569\ub2c8\ub2e4.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">source<\/h2>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:c# decode:true \" >        private static readonly HttpClient httpClient = new();\n\n        private static async Task&lt;string&gt; PostSOAPRequestAsync(string credentials, string Password, string action, string SoapData)\n        {\n            using (HttpContent content = new StringContent(SoapData, Encoding.UTF8, \"text\/xml\"))\n            {   \n                using (HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, action))\n                {\n                    \/\/request.Headers.Add(\"SOAPAction\", \"\");\n                    request.Headers.Add(\"Authorization\", \"Basic \" + Convert.ToBase64String(Encoding.UTF8.GetBytes(credentials + \":\" + Password)));\n                    request.Content = content;\n                    \n                    using (HttpResponseMessage response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead))\n                    {\n                        \/\/response.EnsureSuccessStatusCode(); \/\/ throws an Exception if 404, 500, etc.\n                        return await response.Content.ReadAsStringAsync();\n                    }\n                }\n            }\n        }<\/pre><\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview: \uc2ec\uac01\ub3c4 \ucf54\ub4dc \uc124\uba85 \ud504\ub85c\uc81d\ud2b8 \ud30c\uc77c \uc904 \ube44\ud45c\uc2dc \uc624\ub958(Suppression) \uc0c1\ud0dc\uacbd\uace0 SYSLIB0014 &#8216;WebRequest.Create(string)&#8217;\uc740(\ub294) \uc0ac\uc6a9\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.&#8216;WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete. Use HttpClient instead.&#8217; \ucc38\uc870 : https:\/\/learn.microsoft.com\/ko-kr\/dotnet\/core\/compatibility\/networking\/6.0\/webrequest-deprecated \ubcc0\uacbd \ub0b4\uc6a9 \uc124\uba85 WebRequest,&nbsp;WebClient,&nbsp;ServicePoint&nbsp;\ud074\ub798\uc2a4\ub294 .NET Core \ubc84\uc804 2.0\uc5d0\uc11c \uc774\uc804 \ubc84\uc804\uacfc\uc758 \ud638\ud658\uc131\uc744 \uc704\ud574 \ucd94\uac00\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \uadf8\ub7ec\ub098 \uc774\ub4e4 \ud074\ub798\uc2a4\ub294&nbsp;WebRequest.GetRequestStream\uc774 \uc751\ub2f5 \uc804\uccb4\uc5d0 \ub300\ud574 \uba54\ubaa8\ub9ac\ub97c \ud560\ub2f9\ud558\uace0&nbsp;WebClient.CancelAsync\uac00 \uc989\uc2dc \ucde8\uc18c\ub418\uc9c0 \uc54a\ub294 \uacbd\uc6b0\uac00 \ubc1c\uc0dd\ud558\ub294 \ub4f1 \uba87 \uac00\uc9c0\u2026 <span class=\"read-more\"><a href=\"https:\/\/mvc.auctionpro.co.kr\/?page_id=758\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-758","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=758"}],"version-history":[{"count":4,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/758\/revisions"}],"predecessor-version":[{"id":766,"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=\/wp\/v2\/pages\/758\/revisions\/766"}],"wp:attachment":[{"href":"https:\/\/mvc.auctionpro.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}