Http 서버에 folder 만들기

다른 pc에서 http file server를 열어 그곳에 파일을 업로드 하고있습니다.
파일을 넣기 위한 폴더를 만들려고 하는데 405 오류가 나오거나 200으로 응답은 하는데 created가 되지 않아 문제입니다.

아래는 해당 코드입니다. console로 createfolder만 시험 중에 있습니다.

static void Main(string[] args)
        {
            string siteUrl = "http://ip_address/";
            string requestUrl = siteUrl + "foldername";
            // Create the request object
            WebRequest request = WebRequest.Create(requestUrl);
            request.Method = "POST";

            // Send the request and get the response
            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            
                if (response.StatusCode == HttpStatusCode.Created)
                {
                    Console.WriteLine("Folder created successfully.");
                    Console.ReadLine();
                }
                else
                {
                    Console.WriteLine("Folder creation failed. Status code: " + response.StatusCode);
                    Console.ReadLine();
                }
            
        }

이 때 status code는 OK로 동작되고 created되진 않습니다 ㅠㅠ
고수님들의 도움이 필요합니다.

Postman이나
web상에서 post로 요청시에는 정상적으로 업로드가 되는지 먼저 확인해 보셨나요 ?

POST로 생성할 폴더 경로로 요청한다고 디렉토리가 생기지 않습니다. 혹시 WebDAV를 사용하기 위함인가요?

web에 파일을 업로드 할때 uploaddata로 upload되는 것은 확인했습니다.

webDAV를 어떻게 쓰는지는 잘 몰라서 구글링하며 시도해본 코드입니다.

static void Main(string[] args)
        {
            string local = "http://ip_address/";
            string folderName = "foldername";


            using (var webClient = new WebClient())
            {

                var createFolderUrl = $"{local}/{folderName}/";
                var request = (HttpWebRequest)WebRequest.Create(createFolderUrl);

                request.Method = "MKCOL";
                try { 
                using (var response = (HttpWebResponse)request.GetResponse())
                {
                   Console.WriteLine("Folder created successfully!");

                }
                }
                catch (WebException ex)
                {
                    Console.WriteLine($"{ex.Message}");
                    Console.ReadKey();
                }
            }
        }

이 경우에는 405에러코드가 나오더라구요
webDAV를 더 알아보며 시도해보려구요!

브라우저나 postman에서는 요청이 정상 동작 되나,
구현하신 클라이언트 요청 코드에서만 안되시는 거라면

구현 하신 요청 코드가 잘못 된부분이 있으니

피들러 같은 웹 패킷 캡처 툴을 이용해서

요청할때 헤더, 바디 등 차이점이 어떤것이 있는지 먼저 체크해 보시는것을 추천 드립니다.

확인해보겠습니다. 감사합니다.

webDAV도 시도해봤는데 결국 안되네요 ㅠㅠ

저는 tls 없이 anyone으로 시도해봤는데 문서 찾아보니
일반적으로 http 서버로 다른 pc에 접속해서 폴더를 생성할 수는 없다고 나오네요.

잘못 알고있을 수도 있으니 tls 사용하거나 방법을 찾아 보겠습니다!

사실 다른 http서버말고 다른 거 쓰면 금방 할거 같긴하네요…