Available due to protection Level error in asp.net-c #

I have two classes: "passwordsettings" and "helper". Classes are given.

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; } } 

But when I use Them in the click Button event, the following problem occurs. Why is this happening? enter image description here

+4
source share
1 answer

It seems that Helper is essentially a nested class inside PasswordStreangth (sic). Although Helper (as published) is a public class, I assume PasswordStreangth is internal . Why is Helper nested class?

It's possible that PasswordStreangth is your namespace, of course - I don't have VS at hand to check if this will be shown in Intellisense. If this is the case, then presumably Helper is not actually declared public in the version you are building against - perhaps elsewhere in the code or an outdated assembly?

+5
source

Source: https://habr.com/ru/post/1443396/


All Articles