如果异常来自同一类,如何检查它是登录信息异常还是连接丢失异常?
private bool checkFileExists(string absoluteRemoteLocation)
{
try
{
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(absoluteRemoteLocation);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Timeout = timeOut;
request.Credentials = new NetworkCredential(this.username, this.password);
request.GetResponse();
return true;
}
catch(Exception e) //i want to check here
{
var g = e.ToString();
return false;
}
}