c# - Cannot send a content-body with this verb-type -


    ftpwebrequest request = (ftpwebrequest)webrequest.create("ftp://www.mysite.com/public_html/text.txt");     request.method = webrequestmethods.ftp.downloadfile;      request.credentials = new networkcredential(" ", " ");      streamreader sourcestream = new streamreader(environment.currentdirectory + "/text.txt");     byte[] filecontents = encoding.utf8.getbytes(sourcestream.readtoend());     sourcestream.close();     request.contentlength = filecontents.length;      stream requeststream = request.getrequeststream();     requeststream.write(filecontents, 0, filecontents.length);     requeststream.close();      ftpwebresponse response = (ftpwebresponse)request.getresponse();     response.close(); 

stream requeststream = request.getrequeststream(); giving me error "cannot send content-body verb-type.".

any on how fix great.

you have told use downloadfile, ftp retr method - , not take body - in same way http not take body. specify uploadfile (ftp stor) or similar if want send body; or - don't send body.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -