Manni
1/23/2003 1:08:00 PM
I had the same aproach (if I understand you right), I made a solution
with the Cache object!
So I dont have to manualy remove "old" items, since there is a timeout!
It's almost like Session, but there is no need for the "SessionID-cookie".
My problem was that MS didnt implemt the CookieContainer in .NET CF.
So what I did was --
create a class (with the attributes I need to save in "Session").
The next was to add a static function "GET(string SessionID)" to that class!
With that I can get an instance of my class like this
public void MyWM(string sessionID) {
MySess va=MySess.Get(Cache, sessionID);
int nSomeThing;
nSomeThing=MySess.SavedInt;
//and so on
To first generate it I use a "Initial SessionID" like:
public string StartMethod(.......) {
MySess va=MySess.Get(Cache, Context.......SessionID);
.......
return(Context....SessionID); // use from the client in subsequent calls!!!
So last not least what does the MySess in Get???
public static MySess Get(Cache cx,string SessionID) {
MySess msTmp;
if(cx[SessionID]==null) {
msTmp=new MySess(......);
cx.Insert(SessionID,msTmp,DURATION); //where duration is the TTL for that object!
}
return (MySess)cx[SessionID];
}
So what have I got??
A "Session-Environment" where I pass the SessionID as parameter in my WS calls.
It has Timeouts (restarted with every access - even read - to the object!!!!!)
What I need (client) -- the call of an "INIT" Method returning that SessionID.
Hope this helps!
Manfred