I just learned that using Global Variables is a VERY BAD IDEA in Web Page application because it tends to cause issues when multiple users are on the page at the same time accessing
and trying to use that particular variable.
I was instructured to use one of the following:
- use a cookie
- use Session["var"]
- just use a class variable in your page code!!
- (with possible Server.Transfer)": use Context["var"]
- use a ViewState["var"] variable or a hidden TextBox
- use Application["var"]
Therefore the "page class member variable"
However I am really unfamilar with these nor do I know which is the best to use in my situation.
Currently my web application have a calendar, users can connect and select a date for a task to run, so I could have many users scheduling various tasks at the same time.
The DateTime needs to be saved, currently I was using Global Variables as defined previouslly (which is supposdly BAD).
Can someone tell me which method I should be using (and possible why) and maybe an example on how I could apply this to me DateTime varable (dtSelected).