SecurityException was unhandled when using isolated storage

最后都变了- 提交于 2019-12-12 11:33:30

问题


When using this code I get the above error:

        var userSettings = new UserSettings()
        {
            Username = TextBox_Username.ToString(),
            Password = TextBox_Password.ToString(),
            Operator = OperatorList.O2
        };

        var settings = IsolatedStorageSettings.ApplicationSettings;
        settings.Add("UserSettings", userSettings);
        settings.Save();

I'm not sure why? though.


回答1:


Fixed it. Any stored class needs to be marked as public marking classes internal is not allowed. The issue happened because C# does not default to public scope with new classes.



来源:https://stackoverflow.com/questions/4209280/securityexception-was-unhandled-when-using-isolated-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!