如果我运行我的程序并且 strUploadIP 没有在我的网络中退出,我的整个应用程序就会卡住
FileInfo toUpload = new FileInfo(strFile);
FtpWebRequest req = (FtpWebRequest)WebRequest.Create(@"ftp://" + **strUploadIP** + @"/" + strUser);
req.Method = WebRequestMethods.Ftp.MakeDirectory;
req.Credentials = new NetworkCredential(strUusername, strUpassword);
try
{
using (var resp = (FtpWebResponse)req.GetResponse())
{
Console.WriteLine(resp.StatusCode);
}
}
我怎样才能尝试抓住这个或什么?