using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.SessionState;
public partial class _Default : System.Web.UI.Page
{
MyState _state = null;
protected void Page_Load(object sender, EventArgs e)
{
this._state = MyState.Init(this.Session);
}
protected void Button1_Click(object sender, EventArgs e)
{
this._state.Antal += 1;
_tbAntal.Text = this._state.Antal.ToString();
}
protected void Button2_Click(object sender, EventArgs e)
{
this._state.Antal += 3;
_tbAntal.Text = this._state.Antal.ToString();
}
}
class MyState
{
const string _name = "{1374BFDE-B051-4fa3-8A7A-E506233B2AB6}";
public int Antal = 0;
public static MyState Init( HttpSessionState state )
{
MyState s = null;
if(state[_name] == null)
{
s = new MyState();
state[_name] = s;
}
else
s = state[_name] as MyState;
return s;
}
}
The life of a computer/sci-fy/teccie-nerd :-) Interested in lots of stuff like: Net, C#, Software Architecture, IoT, building stuff (like sensors based on RPI Pico W), Cars, Books, meeting people, learning new stuff, Cyber Security
Tuesday, May 16, 2006
Smart refence state class for web apps
Subscribe to:
Post Comments (Atom)
Lazzes Smart Home - 2023
Here is an overview of the components in the Smart Home as of now. More stuff than I tought :-)
-
If you, like me - use VLC mediaplayer to view all your media, you may have run into the same problem as I. That is, when we watch multiple m...
-
1) Define constants const int WM_KEYDOWN = 0x100; const int WM_KEYUP = 0x101; 2) Add interface, IMessageFilter public partial class Form1 : ...
-
The DivX register app is hardcoded to use the System32 folder as path for Rundll32, which of course doesn't exist on a 64bit system. So ...
No comments:
Post a Comment