我有两个班级'密码设置'和'帮助'。这些课程是给出的。
Passwordsettings.cs
public class PasswordSetting
{
public PasswordSetting()
{
}
//password age , 80, 180, 360 days
public int Duration { get; set; }
//password minimum length
public int MinLength { get; set; }
//password maximum length
public int MaxLength { get; set; }
//password Numbers length
public int NumsLength { get; set; }
//password Upper letter length
public int UpperLength { get; set; }
//password Special character length
public int SpecialLength { get; set; }
//password valid special characters
public string SpecialChars { get; set; }
}
Helper.cs
public class Helper
{
public Helper()
{
//TODO: Add constructor logic here
}
public static PasswordSetting GetPasswordSetting()
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(HttpContext.Current.Server.MapPath("~/PasswordPolicy.xml"));
PasswordSetting passwordSetting = new PasswordSetting();
foreach (XmlNode node in xmlDoc.ChildNodes)
{
foreach (XmlNode node2 in node.ChildNodes)
{
passwordSetting.Duration = int.Parse(node2["duration"].InnerText);
passwordSetting.MinLength = int.Parse(node2["minLength"].InnerText);
passwordSetting.MaxLength = int.Parse(node2["maxLength"].InnerText);
passwordSetting.NumsLength = int.Parse(node2["numsLength"].InnerText);
passwordSetting.SpecialLength = int.Parse(node2["specialLength"].InnerText);
passwordSetting.UpperLength = int.Parse(node2["upperLength"].InnerText);
passwordSetting.SpecialChars = node2["specialChars"].InnerText;
}
}
return passwordSetting;
}
}
但是当我在按钮点击事件中使用Them时会发生以下问题..为什么会发生这种情况?
答案 0 :(得分:5)
由于某种原因,Helper
实际 PasswordStreangth
(原文如此)中的嵌套类看起来如此。虽然Helper
(已发布)是公共课,但我的猜测是PasswordStreangth
是internal
。为什么Helper
仍然是嵌套类?
当然PasswordStreangth
可能是你的命名空间 - 当然我没有VS来检查它是否会在Intellisense中以那种方式显示。如果是这种情况,那么可能Helper
实际上并未在您构建的版本中声明为公共 - 可能是代码中其他地方的更改,或者是陈旧的构建?