public partial class Site : System.Web.UI.MasterPage { int i = 0; //эта переменная не выполняется в обработчике дважды // происходит переинициализация LinkButton link = new LinkButton(); public void link_Click(object sender, EventArgs e) { i++; //здесь происходит событие увеличения переменной i link.Text = i; } protected void Page_Load(object sender, EventArgs e) { link.Text = "+++"; link.Click += new EventHandler(link_Click); form.Controls.Add(l); form.Controls.Add(link) } } More precisely, it is executed once, as if the whole page is being reinitialized, but old data is added to the link initialization itself.
the point is that static data changes, but remains in memory when even the browser is reset.
if the project code is not changed, then the next application launch gives out the data that was initialized in the previous one
class ins { public static int i; public void count() { i++; } public static int getI() { return i; } }