Using the webclient to upload a file 405 error problem

前端 未结 1 479
野趣味
野趣味 2021-01-24 16:33
VS C# 2005

I am using the code below to upload a file to a server running windows IIS 5.1.

I am just testing on our local server running window

1条回答
  •  生来不讨喜
    2021-01-24 17:14

    Only registered file types can accept requests with a POST method in IIS. See this "How to resolve HTTP 405" article for more details.

    Also, for posting the file, you need to make sure that server side script handles this upload properly, if you want it to appear in the folder you're uploading. Your URL (first argument in the wc.UploadFile) should be that server side script that handles the upload.

    0 讨论(0)
提交回复
热议问题