unit UserSessionUnit; interface uses IWUserSessionBase, SysUtils, Classes, IWApplication; type TIWUserSession = class(TIWUserSessionBase) procedure IWUserSessionBaseCreate(Sender: TObject); procedure IWUserSessionBaseDestroy(Sender: TObject); private FMyName: string; FMyAge: Integer; FMyInfos: TStrings; public property MyName: string read FMyName write FMyName; property MyAge: Integer read FMyAge write FMyAge; property MyInfos: TStrings read FMyInfos write FMyInfos; end; implementation {$R *.dfm} procedure TIWUserSession.IWUserSessionBaseCreate(Sender: TObject); begin FMyInfos := TStringList.Create; end; procedure TIWUserSession.IWUserSessionBaseDestroy(Sender: TObject); begin FMyInfos.Free; end; end.
uses ServerController, Unit2; procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList); begin UserSession.MyName := ‘aaa‘; UserSession.MyAge := 111; UserSession.MyInfos.Add(‘Var1=123‘); UserSession.MyInfos.Add(‘Var2=456‘); TIWForm2.Create(WebApplication).Show; end;
uses ServerController; procedure TIWForm2.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList); begin IWMemo1.Lines.Add(UserSession.MyName); IWMemo1.Lines.Add(UserSession.MyAge.ToString()); IWMemo1.Lines.Add(UserSession.MyInfos.Values[‘Var1‘]); IWMemo1.Lines.Add(UserSession.MyInfos.Values[‘Var2‘]); end;
使用 IntraWeb (40) - 自定义 Session 数据,布布扣,bubuko.com
使用 IntraWeb (40) - 自定义 Session 数据
原文地址:http://www.cnblogs.com/del/p/3812231.html