问题描述
- 用webBrowser浏览 FTP文件
-
用webBrowser浏览 FTP文件,用户和密码已经写在程序里,访问的时候仍然需要输入用户名和密码。FtpWebRequest FtpClient;
Uri uri = new Uri("ftp://192.168.0.1/123/123.pdf");
webBrowser1.Url = uri;
FtpClient = (FtpWebRequest)WebRequest.Create(uri);
FtpClient.Credentials.GetCredential(uri, "user").UserName = "admin";
FtpClient.Credentials.GetCredential(uri, "user").Password = "123";
FtpClient.Credentials.GetCredential(uri, "user").Domain = "192.168.0.1";
FtpClient.Method = WebRequestMethods.Ftp.ListDirectory;请问哪里出错了?谢谢。
时间: 2025-01-21 00:56:36