I have an asp.net application with a static “global” class. Inside of the static class I have a variable called user. When a user logs in a set that variable. Debugging through the log process. All my other static variable seems to be fine except two. I am not sure why I am getting ‘GlobalVariables.User’ threw an exception of type ‘System.NullReferenceException’.
Can anyone shed some light on this. Thanks
namespace GlobalClass
public static class GlobalVariables
public static User User { get; set; }
Its probably throwing because you didn’t create an instance of User. One way to fix it is the following.