I just want to create a simple counter which increases its value when a button is pressed in the current session. So, I'm trying to make an int variable in global.asax
in the
void Session_Start(object sender, EventArgs e)
which has an initial value of 0, obviously. In addition to that, I will set its value to 0 again when the session ends. Since variables made in global.asax
have global visibility, why does it throw an error when I try to refer to it at my button's event page?
I'm creating it as
public static int p1;
This is the line of code I use it in the other page:
p2 = p1 + counter;