Hi,
Am I correct saying that with ASP.Net, a static class, is basically a single server object, that is active across sessions?
Meaning that if I set a value of a static class, all sessions will read the same value. But that means that if one user's session sets this value again with something new, EVERYONE will read this new value, not the old one.
What I'm getting at is that I'd like to use something along the lines of:
I just think it's way cleaner than:
Particularly because I don't need the cast with a static method. But, I think the nature of a static class (as I described above) makes this impossible, as it will return 'server' values, instead of 'client' (read: session) variables.
Any ideas/suggestions about this?
Am I correct saying that with ASP.Net, a static class, is basically a single server object, that is active across sessions?
Meaning that if I set a value of a static class, all sessions will read the same value. But that means that if one user's session sets this value again with something new, EVERYONE will read this new value, not the old one.
What I'm getting at is that I'd like to use something along the lines of:
Code:
string text = StaticClassName.SomeValue;
I just think it's way cleaner than:
Code:
string text = Session["SomeValue"].ToString();
Particularly because I don't need the cast with a static method. But, I think the nature of a static class (as I described above) makes this impossible, as it will return 'server' values, instead of 'client' (read: session) variables.
Any ideas/suggestions about this?