首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Powershell FTPWebRequest和EnableSsl = True

Powershell FTPWebRequest和EnableSsl = True
EN

Stack Overflow用户
提问于 2009-08-14 17:15:22
回答 1查看 7.1K关注 0票数 2

我通过Powershell搜索了这个站点,找到了一个FTPWebRequest示例。我将它投入使用,它工作得很好。但是,当我通过EnableSsl=$True启用SSL时,我得到的只是超时或延迟的"227进入被动模式“,这会中断该过程。一旦我禁用了EnableSsl,我就可以直接飞过去。谁能给我指个方向?FTP主机支持SSL。

在获得列表并找到匹配项之后,我最终希望将方法更改为DownloadFile,并循环代码以下载文件。不过,我想安全地做这件事。

代码语言:javascript
复制
# Create an FTPWebRequest object to handle the connection to the FTP server
$ftprequest = [System.Net.FtpWebRequest]::Create($sourceuri)

# Set the request's network credentials for an authenticated connection
$ftprequest.Credentials = New-Object System.Net.NetworkCredential($username,$password)

# Set FTPWebRequest method to ListDirectory
$ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::ListDirectory
$ftprequest.EnableSsl = $True
$ftprequest.UseBinary = $False
$ftprequest.UsePassive = $True
$ftprequest.KeepAlive = $False

$ftpresponse = $ftprequest.GetResponse()

Write-Out $ftpresponse.StatusCode
Write-Out $ftpresponse.StatusDescription
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2009-10-19 20:55:12

来发现,自发的问题是服务器端的。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/1279041

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档