我尝试使用FtpWebRequest列出文件详细信息,但很多时它会因WebException而失败并显示错误530用户未登录.
这怎么可能,它使用相同的凭据在某些时候工作?
摘自代码:
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpuri));
reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(userName, password);
string[] downloadFiles = new string[0];
reqFTP.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
WebResponse response = reqFTP.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
downloadFiles = reader.ReadToEnd().Replace("\r\n", "¤").Split('¤');
reader.Close();
response.Close();
Run Code Online (Sandbox Code Playgroud) 在阅读了Steven Sanderson的书籍Pro ASP.NET MVC之后,我确信使用ASP.NET MVC而不是webforms.
由于ASP.NET MVC明显受到Ruby on Rails的启发以及"约定优于配置"的好处,因此我觉得MVC中的M完全缺失了!
在我看来,使用Rails的简易性同样来自于使用模型的惯例.特别是在验证时,因为这显然属于模型而不是表示层!
在Rails中,它很容易编写:validates_presence_of:author甚至更好的validates_uniqueness_of:title
那么为什么ASP.NET(M)VC中没有M?
我有多个if在我的控制器动作
中如下所述if()
{
}
if()
{
}
if()
{
}
if()
{
}
现在我想要一个else(当所有条件都失败时执行..假)