ftpwebrequest - The underlying connection was closed. The server committed a protocol violation vb.net -
i need help, none can't seem find solution problem.
i'm trying create directory in ftp server:
dim request ftpwebrequest = ftpwebrequest.create("ftp:\\*******") dim creds networkcredential = new networkcredential("****", "*****") request.credentials = creds request.keepalive = true request.enablessl = true request.usepassive = true request.timeout = 10000000 request.readwritetimeout = 10000000 servicepointmanager.servercertificatevalidationcallback = new system.net.security.remotecertificatevalidationcallback(addressof customcertvalidation) dim resp ftpwebresponse = nothing request.method = webrequestmethods.ftp.listdirectorydetails using resp resp = request.getresponse() dim sr streamreader = new streamreader(resp.getresponsestream(), system.text.encoding.ascii) dim s string = sr.readtoend() if not s.contains("newfolder") request = ftpwebrequest.create("ftp:\\********") request.credentials = creds request.method = webrequestmethods.ftp.makedirectory resp = request.getresponse() console.writeline(resp.statuscode & "created") else console.writeline("directory exists") end if end using catch ex exception console.writeline(ex.tostring) end try
function customcertvalidation
function customcertvalidation(byval sender object, byval cert x509certificate, byval chain x509chain, byval errors sslpolicyerrors) boolean return true end function
i following error:
i have tried on web nothing seems work, can please tell me wrong. thank
Comments
Post a Comment