I am new to MVC and I have written my application incorrectly and I am trying to work out how to do it properly.
It's a pretty normal situation where the system is accessed by username & password.
Currently, based on this, I have populated a static "network object" as it is needed for every subsequent call to an API to retrieve data.
But, as you have probably know, and I have just realised, this means other people are being automatically logged in as I store a
public static bool LoggedIn { get; set; }
I also have a class which stores sensitive data as follows:
public static NetworkInfo networkstuff { get; set; }
Which contains:
public class NetworkInfo
{
public string baseUrl { get; set; }
public string userName { get; set; }
public string userPassword { get; set; }
public Proxy proxyInfo { get; set; }
}
I need to make this information available across all controllers to avoid having to regenerate it every time I call the API.
But, the only way I can find to do it is using a Session variable. And when I read about Session variables it tells me NOT to store sensitive information in it.
Is there a more correct way of doing this?