I have written a simple webapp in asp net. The first time I go through the program Everything works fine, but if I go there again it uses that variables from my last session.
So the questions are
-
Is there anyway to correct this?
-
Does it have something to do with how I make my public variables?
-
Could I store the variables as cookies, then delete them when the page closes?
This is how I make my public variables:
static class vars
{
public static List<string> directory_names = new List<string>();
public static List<string> directory = new List<string>();
public static int numvar = 0;
//There are more but they all are made the same way
}
Any Ideas are welcome.
Thanks,
Adam
You should avoid static as it means the variable will be the same for every user connected (plus you will probably face threading issue).
Here is a link on SO about this: What is better: Static variable V.S. Asp.NET Application Session?